For this week's assignment, we were to create JUnit test cases for our Competitive Robot that we created (see previous post). We were to create different test cases such as behavioral and acceptance tests.
The Easy Tests
The acceptance test is the easiest to create due to the sample code that was provided to us. This test checks how good or bad your robot is against other robots like the ones in the sample robots. I tested my robot against SittingDuck robot and should win a 100 percent of the time. I also tested my robot against Tracker, but for some reason it is giving me some confusing resultss. I built my robot to win against Tracker atleast 80 percent of the time, and it has been proven when I run it using Robocode. For some reason on the JUnit test, my robot can only win once at the most so the test case that I made keeps failing. I decided to choose another robot that I can compete with mine. Embarrassingly I can't beat any other robots so I chose Target as my next test case which is pretty much like Sitting Duck.
The Hard Tests
The behavioral test was probably the hardest for my robot since my robot doesn't have any specific movement to follow unlike the Walls robot. My robot follows and moves parallel to its enemy this makes it hard to create a test for this specific behavior. It also moves into the center when it gets near corner. This particular behavior is the only clear and easiest test that I've created. I also created a test case the checks if my robot hits the wall and move on the opposite way. The hardest that I test case that I created is testing the fire power used by my robot. Depending on the its distance against the other robot, it fires a certain bullet power.
Jacoco Coverage
The Jacoco revealed 96% coverage for my program. The other 4% were "if" cases in my main robot code that was not used upon running the program.
Conclusion
I feel that I could have done better in choosing test cases for my robot. Also my robot needs lots of improvements so it can easily be tested. I need to improve the way my robot moves and fires as it can only beat the stationary robot. Maybe create more predictable or patterned movements so it is easy to create behavioral test cases.
Below is the current distribution of my robot.
Download: RiceMusubi
No comments:
Post a Comment