Thursday, October 8, 2009

JUnit: Robocode Testing ... not a Crew

JUnit testing is code that is programmed to test a programmers main code to see that the code that they wrote is doing what it is suppose to be doing, or it could be used to see statistics in the code so that the programmer can make the program better.

When we first started using JUnit, I noticed that not just me but everyone was having a hard time just trying to write code to test our main java file. I thought it was a little funny but it is pretty hard. However, now that I know how to do it and how it works I think I can make more JUnit cases for future programs.

What I tested in my robocode program is if my robot can beat two sample robots, if it turns to try and ram another robot if another robot is close, fire power, if my robot loses all its energy, and if it at least hits another robot when it fires. I believe that all these test cases were hard to make because at first I had no clue on what I was doing. I had to sit and look at classmate's JUnit cases and understand how and what they are doing. And since I took too long I am turning in my assignment late. I could have turned it in on time, but I wanted to understand the code fully instead of just turning it in.

Now that I do understand it, there is no problem making another one. What I could change though is how I made my robot because then writing these test cases would be a whole lot easier. What Emma did for me is run my test cases and show me if they failed or executed. This showed me what needed improvement.

Alright!!! without taking more time and not turning my code in, my robocode could be found here.

No comments:

Post a Comment