Skip to content

Annotate your tests with time limits and check if they behaved accordantly

License

Notifications You must be signed in to change notification settings

Danny02/junit-timelimit-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JUnit Time Limits Build Status Test Coverage

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 .

Configuration

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

Credits

Inspired by Bazel Test Timeouts

Implementation Idea from Sam Brannen see Stackoverflow post

About

Annotate your tests with time limits and check if they behaved accordantly

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages