Public:Automatic tests
From YaddaWiki
Contents |
Tests
Tests are significant part of the programming effort. They not only have to be written, but to be maintained with rest of the code as well. Therefore following rules apply:
Separation of the unit and integration tests
Unit tests are tests, which do not require specific environment to be run, and may be run during each compilation.
Integration tests require specific environment and are not expected to be run during each compilation.
Unit test location
All unit tests are located within standard maven directory structure, in:
src/test/java
All resources required by tests, but not required by the executable code are stored in:
src/test/resources
Unit tests are tests for the classes, so:
- tests referring to the custom class are in the same package as tested class
- tests for the class are in class named ClassNameTest, e.g. for StringConverter tests are StringConverterTest
Test method naming
All testing methods must have clear and significant names. It is recommended that each test method has name methodName__contitionsToTest, for the method formatString() it would be for example:
formatString__null_value() formatString__only_numbers() formatString__too_many_placeholders()