One of backend’s have very expensive Integration Tests. Complete suite takes about 40 minutes. Many of tests were written in a one big class, just to assure that start and close of backend will take place only one time. Moreover, there is used JUnit Nested Runner from NitorCreations. After backend development finished, there were many bugs repaired in maintenance stage and many features added in small change requests. Adding changes always makes some tests to be added. There was never a good time (and budget) to improve tests. In conclusion: now exists one big class with many subclasses and hundreds of scenarios inside.
With help come up JUnit 4.9.
Need to run Java based Integration Tests in a way that Application starts at the beginning and close and the end of the Suite. On of possible solutions is to use
org.junit.rules.ExternalResource toghether with
@ClassRule from JUnit in version 4.9 or up.
Full solution can be found at: Stack Overflow
After just few short hours of development, there are covered most valuable goals:
- Tests exists in separate classes (per feature)
- There are Scenarios connected to group of Features and Suites
- One big Suite run tests by starting backend at the beginning and closing at the end
- Can run one class separately
- Can run complete Suite by one click
- Can run using gradle in CI environment
Posted in: Sortware