Wednesday, October 7, 2009

Junit Testing My Patience

After learning about build systems we were given the task to create jUnit tests for our robots.

You can find my distribution for my robot with test cases here.

It is one thing to design your robot, but it is a whole other thing to figure out tests for your robot. Trying to think of a way I could test a robot that doesn't have any predefined move path was torture. The fact that my robot's movement is based on the positioning of the enemy robot made it very difficult for me to test the proper movement.

The easiest test for my to do was, other than acceptance tests, were the firing tests. My robot fires very conservatively so it was easy to check, if they move don't fire, if they sit still fire!

The biggest problem was the unit test and the movement behavioral test. The unit test was very difficult because my robot in itself is very simple. Moving constantly in a predefined angled but relative to the enemy, the only thing I could think of was having the only formula I could have in it, which was one we had done earlier in our run through robocode, the Fire03 robot we built who's firepower was determined by the distance from the enemy.

Since this is in fact the first time we are doing tests I don't feel as confident in my test cases than I should be. After all my robot didn't do so well in the competition because I was unable to compensate or catch certain interactions with different movement patterns. All of which could have been better if there was proper testing.

I wasn't able to figure out how to run emma, although understand what it does essentially. I think my robot has a long way to go still. After some though I believe that one of the ways it could be modified for both testing sake and actual performance is to have a more clearly defined movement pattern. Right now I feel that is just too basic and very hard to test for, well how hard is it to test for a robot that moves forward? But then how hard is it to test for a robot that moves randomly without using the math.random() function. I kind of feel like that at this point, stuck between something really basic and something overly complex.

I think simplicity is the key to more sleep.

No comments:

Post a Comment