Public:Automatic tests

From YaddaWiki

Revision as of 08:15, 20 August 2018 by Lukdumi (Talk | contribs)
Jump to: navigation, search

Contents

Tests

Tests are significant part of the programming effort. They not only have to be written, but also be maintained with the rest of the code. Therefore the 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 the 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 of specific classes, so:

  • a test class should be in the same package as the tested class
  • the name of the test class should be made of the name of the tested class suffixed with `Test`. For example if the tested class name was StringConverter, its test class would be StringConverterTest

Test method naming

All testing methods must have clear and significant names. It is recommended that each test method has name methodName__conditionsToTest, for the method formatString() it would be for example:

formatString__null_value()
formatString__only_numbers()
formatString__too_many_placeholders()
Personal tools