Running Unit Tests
Developers typically run Unit Tests through IDEs, not through the classic JUnit test runners. Unit tests can also be run through Maven - indeed, if you're not careful, Maven will run unit tests even when you don't want it. When tests are run through Maven, the Surefire plugin can produce various reports on the health of the unit test suite. In Financials 6, running the unit test suite must be done against a database populated with demo data from both the Financials and Rice datasets - ie, to run locally, you should run against a local satellite database.
...
Code Block |
---|
mvn test -e -Dtest=org.kuali.kfs.module.ar.batch.CustomerInvoiceWriteoffBatchDigesterTest -pl kfs-ar |
Unit Testing Before Submitting a Pull Request
Please run the PreCommitSuite unit test within the kfs-core module before submitting a pull request to verify that your code changes do not break standards in the KFS project. The PreCommitSuite has been specifically chosen to represent tests which enforce Financials standards and which run relatively quickly. You can run this within your IDE or from the command line using this command:
Code Block |
---|
mvn test -e -Dtest=PreCommitSuite -pl kfs-core |
No Broken Windows
The tests are basically binary: green or red. They either all pass, or they don't. Normally projects developing with unit tests fix them as soon as they break, so most of the time 100% pass. This is the methodology that makes automated testing effective. It's much easier to maintain the tests if broken tests are fixed immediately. That minimizes the changes which need to be considered during troubleshooting, and minimizes further development that depends on buggy code. It's also an opportunity to make the test itself easier to maintain, and by eliminating bugs in production code it improves the productivity of the developers affected by that bug and acts as a form of communication between remote developers.