Unit Testing
Introduction
Testing is the most important thing a code monkey ever does. You should always write a JUnit test for each new bit of code (or fix) that you develop. PCGen has a very large and complex code base, and your small change can easily break something unforseen down the line, running the test suite reduces this risk heavily.
Here is how to test the Unit Tests you have written:
- Test: ant clean test
- Lather, rinse, repeat.
If all goes well, you will see the success.notice target echo output in ant. If things go wrong, the failure.notice target echoes output instead: investigate the output to see what failed.
Alternatively, you can do the same with maven and produce a site report on unit tests: maven site
The advantages is a nicely linked report with red/green markers and test metrics. The disadvantage is that it takes considerably longer as maven generates many reports, not just the one for unit tests.
Any questions, comments etc are welcome!