Clone this wiki locally
Welcome to the JUnit wiki!
- Download and Install
- Getting Started
- Release Notes
- Maintainer Documentation
- Deprecation Policy
- I want to help!
- Latest JUnit Questions on StackOverflow
- Latest JUnit API JavaDocs
JUnit Usage and Idioms
- Assertions - your bread and butter for unit testing
- Test Runners - how tests should be executed
- Aggregating tests in Suites - how to combine multiple related tests into a test suite
- Test Execution Order - specifying what order to run unit tests
- Exception Testing - how to specify expected exceptions in unit tests
- Matchers and assertThat - how to use Hamcrest matchers and more descriptive assertions
- Ignoring Tests - how to disable test methods or classes
- Timeout for Tests - how to specify maximum execution times for tests
- Parameterized Tests - writing tests that can be executed multiple times with different parameter values
- Assumptions with Assume - similar to assertions, but without making tests fail
- Rules - stop extending abstract test classes and start writing test rules
- Theories - write tests that are more like scientific experiments using randomly generated data
- Test Fixtures - specify set up and clean up methods on a per-method and per-class basis
- Categories - group your tests together for easier test filtering
- Use with Maven - how to use JUnit with your Maven build
- Use with Gradle - how to use JUnit with your Gradle build
- Multithreaded code and Concurrency - basic ideas behind testing concurrent code
- Java contract test helpers
- Continuous Testing
- Custom Runners
- github.com/trajano/commons-testing for UtilityClassTestUtil per #646
- System Rules – A collection of JUnit rules for testing code that uses java.lang.System.
JUnit Toolbox – Provides runners for parallel testing, a
PoolingWaitclass to ease asynchronous testing, and a
WildcardPatternSuitewhich allow you to specify wildcard patterns instead of explicitly listing all classes when you create a suite class.
- junit-dataprovider – A TestNG like dataprovider (see here) runner for JUnit.
- junit-quickcheck – QuickCheck-style parameter suppliers for JUnit theories. Uses junit.contrib's version of the theories machinery, which respects generics on theory parameters.
- JGiven - Behavior-Driven Development (BDD) for JUnit