It is common to categorize unit test by how quickly they execute. This for example enables enables one to execute only test which run in a very short amount of time.
This could be used for i.e. :
- a background process which test on each file save
- a git pre commit hook
- as a first testing stage of the CI pipeline
The problem one faces is, that these categories need to be curated by hand. This is especially error prone to changes over time.
This Extension gives you annotations to categorize your tests in how quick they run and also checks the execution time of each categorized test.
The current categories are:
Name | Time Limit |
---|---|
@Short | 0 - 100ms |
@Medium | 80 - 500ms |
@Long | 400 - 1500ms |
@Eternal | over 1500ms |
@TimeLimit | configurable |
Besides using the annotations, you need to enable the Extension. Take a look at the JUnit documentation on how to do it, the prefered way is to register it automatically .
You can configure own time limit categories or overwrite defaults by using JUnit Parameters.
Just set the following properties:
com.github.danny02.timeout.categoryname.lower=300
com.github.danny02.timeout.categoryname.upper=750
Inspired by Bazel Test Timeouts
Implementation Idea from Sam Brannen see Stackoverflow post