-
-
Notifications
You must be signed in to change notification settings - Fork 100
Test Practices
tfr42 edited this page Sep 7, 2018
·
13 revisions
This page lines out agreed practices for dealing with Unit / Integration practices in deegree.
Status: Draft (needs to be discussed)
- Unit Tests are fast: It should take less than half a second to run a unit test.
- Unit Tests run in memory: They have no "hard" dependencies on anything not in memory
- Unit Tests must be self-contained: They are not allowed to access external systems (e.g. databases, HTTP servers, etc.)
- Unit Tests must not require an Internet connection!
- Unit Tests should not produce any console output nor produce log messages on TRACE, or DEBUG level
- Unit Tests are following the naming convention *Test.java or *TestCase.java
- Unit Tests are executed by the Maven surefire plugin during the maven lifecycle phase test
- Unit Tests are provided for all behavior changes of deegree!
- Unit Tests verifying bug fixes provide test methods where the method name includes the issue ID such as "verifyThatIssue4232<SUMMARY>IsFixed"
Found the following issues when building 3.3.7 without network connection
[INFO] Building deegree-core-base 3.3.7
Tests run: 19, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.804 sec <<< FAILURE!
[INFO] Building deegree-protocol-wms 3.3.7
Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.244 sec <<< FAILURE!
Tests run: 22, Failures: 0, Errors: 20, Skipped: 1, Time elapsed: 0.041 sec <<< FAILURE!
[INFO] Building deegree-tilestore-remotewms 3.3.7
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.35 sec <<< FAILURE!
I suggest to solve these failures by removing the external dependencies or mocking them.
- Integration Tests can make use of external systems such as databases, servers, or access the filesystem, or network interfaces
- Integration Tests are executed by the Maven failsafe plugin during the maven lifecycle phase integration-test
- Integration Tests are following the naming convention *IT.java, *IntegrationTest.java, or *PerformanceTest.java
- Integration Tests can be much slower than unit tests