TBD: include pointers to "good" unit tests in the project
Geode is tested with a combination of junit, dunit (distributed unit) and regression tests. Junit tests are written as with any other project while dunit tests use a multi-JVM environment (see Distributed Unit Tests).
JUnit tests should
- Use Junit 4 Syntax
- End with JUnitTest
- Contain an Category annotation of either UnitTest or IntegrationTest. UnitTests as should complete in milliseconds and test a specific class.
Always write unit tests for new functionality and always ensure that all unit tests pass before submitting a pull request. Try to make sure new functionality is covered by unit tests, whether or not there are also integrations tests as well.
Our ultimate goal is to have the highest quality product for our users. There are multiple ways of slicing this issue, but if we go all the way back to when the code is being developed, we find unit tests. Unit tests are the foundation in continuous software testing, with the top characteristic of being automated. Good unit testing can save a lot of time and energy later on in the software development lifecycle.
Possible goals to strive for when creating our tests: (from http://artofunittesting.com/definition-of-a-unit-test/)
- Able to be fully automated
- Has full control over all the pieces running (Use mocks or stubs to achieve this isolation when needed)
- Can be run in any order if part of many other tests
- Runs in memory (no DB or File access, for example)
- Consistently returns the same result (You always run the same test, so no random numbers, for example. save those for integration or range tests)
- Runs fast
- Tests a single logical concept in the system
- Trustworthy (when you see its result, you don't need to debug the code just to be sure)
Good sites for getting ideas: