Wednesday, October 7, 2009

Quality Assurance Testing

Creating behavioral, acceptance and unit tests is time consuming and not a whole lot of fun, but it does pay off. I created six tests for my Robocode robot FlankBot to create somewhat of a benchmark. This will be useful to me when I start changing the code for my robot. Reason being, if I make changes and it does not pass these benchmarks, then I know that I must of done something wrong and I should then go back and investigate it.

The test I created test the following:

Test if FlankBot flanks most of the time.
Test if FlankBot has good survivability techniques.
Test if FlankBot can continually beat Walls (a hard bot to beat).
Test if FlankBot can continually beat Corners.
Test if FlankBot can avoid being rammed into.
Test if FlankBot has good shooting accuracy skills against Walls.

I have to say the most time consuming part of this was getting Eclipse IDE to work with Ant. There really has to be a better way to make them work together smoothly. Importing projects and getting JUnit to work as well seems a lot more hassle then it needs to be. At this point I am missing Make and VIM. I will continue looking for a better way to improve these oddities and various problems with importing other peoples projects as well.

Most of the tests I was able to perform were centered around behavioral tests. Unit tests seemed somewhat counter intuitive to the way my bot was designed, but if you can think of a way to make it work after looking at FlankBot, I'd love to hear it. If I redesigned my bot to have explicit movement methods, it would of worked better for the unit tests. All in all, it was a good learning experience, but took a little more time then I thought it would take, as there is more building and test code to work with then there is actual robot code.

Last but not least, I'd like to mention the tool EMMA. It is a code coverage tool, which does exactly what it says. It checks how much code your JUnit tests covered. I found that my code coverage is not as high as I hoped for. This is most likely because I have a few methods that are not fully implemented yet and have yet to be used.

The lessons I learned the last few days with build code will have a great effect on larger projects and alleviate a lot of the frustrations that come with it, there is no doubt about that. I am looking forward to seeing how this scales and incorporating more tools to my reserve.

Download the latest version of FlankBot with Tests here

0 comments:

Post a Comment