I was wondering if anyone has had experience with unit testing their FRC project in netbeans.
I’m not sure how much JUnit is supported by Java ME, but if it does I imagine it could be done by excluding the test folders from the build.xml Ant targets that build the jar for the robot.
I was wondering if anyone else had done this and could describe their project set-up and modifications. I figure asking if anyone did it first is preferable to fording out and trying to hack everything out on my own.
By unit testing, I presume you refer to the process of writing a script to run a particular function or section of code through multiple scenarios and grade it’s performance. If that’s the case, you could, and may want to, do such testing without the use of JUnit. In my extremely limited knowledge of JUnit, there is frankly little that I can do with JUnit that I cannot do with my own custom program, and quite a bit that I would rather not have to run through JUnit.
What testing functionality are you looking for that JUnit gives you?
JUnit is just the standard unit testing framework for Java. You write functions in classes that JUnit automatically recognizes how to run and use different assertions to make sure the code ran the way you intended. Properly used, this promotes robustness in the software’s functionality, early recognition of edge-case bugs, proper software design to keep the modules easily testable, and most importantly protects against quality regression (that a new code change breaks something else that you didn’t intend to change).
There is probably a version out there for Java ME so that’s not likely to be the problem. The auto generated build scripts for the FRC stuff are just very complicated and dense (since they are intended to be managed by netbeans). I was mainly wondering if any teams had gone down this road already so they could share how they configured their project.
As an update, I have yet to undergo this investigation myself, so apologies to the other 2 posters.
(Note: I explained unit testing so much for anyone that happens to stumble along this thread in the future )
This isn’t exactly what you’re looking for I think, but It’s quite awesome. You can add instances of commands (you need to use a command-based approach for this to work well) to the SmartDashboard and test them out individually.
Couple that with the test method/option, and you could have a very nice way to debug/unit test your robot.