Creating tests for my robot was actually quite a difficult process. I ran into various problems which all revolved around me placing the test files in the wrong directory. These were easily solved by placing the files in the correctly location.
I created 2 acceptance tests, 1 behavioral test as well as 1 unit test. For my acceptance tests I pit BlackMagic against SittingDuck and Crazy respectively. For the behavioral test I made sure that my robot's first few moves are to the middle of the battlefield. Lastly for my unit test I made sure that the targeting method for BlackMagic was correct.
At first I found the tests hard to create as I have never done Junit testing before. However as I created more tests I became more comfortable with it. Unfortunately I was not able to reach the specified 6 tests due to the design BlackMagic. Because BlackMagic moves in a random fashion it is nearly impossible to test it's movements. Also the targeting is set to fire ahead of the enemy so it is hard to confirm that my bullets will hit every time. Lastly BlackMagic is very simple and uses very few lines of code which made unit testing even harder.
Considering that BlackMagic is such a random robot I believe that my tests were adequate enough to ensure the quality of my robot as I think that my tests covered almost all the possible inputs for my unit test and I ran multiple tests to confirm that my acceptance tests passed consistently (0% failure).
As far as emma goes in my BlackMagic file I used 100% of the methods and classes, however I only used 94% of the blocks and 93% of the lines. This was due to the fact that the lines specifying what to do if a enemy got too close were never executed. As for the test files, all of them were at 100% for all categories.
If I were to redesign BlackMagic to make it easier to test, I would change its movement from random to a pattern form and also I would add in a more extensive response for when an enemy hits BlackMagic. This would allow for more methods to unit test as well as a more rounded robot.
The current distribution for BlackMagic can be found here.
Wednesday, October 7, 2009
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment