All Classes and Interfaces

Class
Description
If you allocate external resources in a Before method you need to release them after the test runs.
If you allocate expensive external resources in a BeforeClass method you need to release them after all the tests in the class have run.
Runner for use with JUnit 3.8.x-style AllTests classes (those that only implement a static suite() method).
A sorter that orders tests alphanumerically by test name.
A model element that may have annotations.
An AnnotationsValidator validates all annotations of a test class, including its annotated fields and methods.
Validates annotations on classes and methods.
Creates instances of Annotation Validators.
A set of assertion methods useful for writing tests.
A set of methods useful for stating assumptions about the conditions in which a test is meaningful.
An exception class used to implement assumptions (state in which a given test is meaningful and should or should not be executed).
When writing tests, it is common to find that several tests need similar objects created before they can run.
Sometimes several tests need to share computationally expensive setup (like logging into a database).
Implements the JUnit 4 standard test case class model, as defined by the annotations in the org.junit package.
A BlockJUnit4ClassRunner with parameters support.
From a given set of test classes, runs only the classes and methods that are annotated with either the category given with the @IncludeCategory annotation, or a subtype of that category.
 
 
 
Marks a test class or test method as belonging to one or more categories of tests.
Validates that there are no errors in the use of the Category annotation.
Annotates static fields that reference rules or methods that return them.
Thrown when an assertEquals(String, String) fails.
Represents a strategy for computing runners and suites.
Thrown when Max cannot read the MaxCore serialization
Annotating an field or method with @DataPoint will cause the field value or the value returned by the method to be used as a potential parameter for theories in that class, when run with the Theories runner.
Annotating an array or iterable-typed field or method with @DataPoints will cause the values in the array or iterable given to be used as potential parameters for theories in that class when run with the Theories runner.
Represents an object that can describe itself
A Description describes a test which is to be run or has been run.
The DisableOnDebug Rule allows you to label certain rules to be disabled when debugging.
If you put tests in inner classes, Ant, for example, won't find them.
The ErrorCollector rule allows execution of a test to continue after the first problem is found (for example, to collect _all_ the incorrect rows in a table, and report them all at once):
FilterFactory to exclude categories.
The ExpectedException rule allows you to verify that your code throws a specific exception.
A base class for Rules (like TemporaryFolder) that set up an external resource before a test (a file, socket, server, database connection, etc.), and guarantee to tear it down afterward:
A Failure holds a description of the failed test and the exception that was thrown while running it.
The canonical case of filtering is when you want to run a single test method in a class.
Runners that allow filtering should implement this interface.
Extend this class to create a factory that creates Filter.
Exception thrown if the Filter cannot be created.
 
This class allows the user to choose the order of execution of the methods within a test class.
Represents a field on a test class (currently used only for Rules in BlockJUnit4ClassRunner, but custom runners can make other uses)
Parent class for FrameworkField and FrameworkMethod
Represents a method on a test class to be invoked at the appropriate point in test execution.
Annotating a parameter of a @Theory method with @FromDataPoints will limit the datapoints considered as potential values for that parameter to just the DataPoints with the given name.
Sometimes you want to temporarily disable a test or a group of tests.
FilterFactory to include categories.
Represents one or more problems encountered while initializing a Runner
Thrown when an ordering does something invalid (like remove or add children)
Thrown by Runners in case the class under test is not valid.
Aliases the current default JUnit 4 class runner, for future-proofing.
JUnitCore is a facade for running tests.
Convenience import class: these are useful matchers for use with the assertThat method, but they are not currently included in the basic CoreMatchers class from hamcrest.
A replacement for JUnitCore, which keeps track of runtime and failure history, and reorders tests to maximize the chances that a failing test occurs early in the test run.
Stores a subset of the history of each test: Last failure timestamp Duration of last execution
Represents a receiver for values of annotated fields/methods together with the declaring member.
A MethodRule is an alteration in how a test method is run and reported.
Sort the methods into a specified execution order.
Collects multiple Throwables into one exception.
Thrown when a filter removes all tests from a runner.
Interface for runners that allow ordering of tests.
Orders tests.
Reorders tests.
Context about the ordering being applied.
Factory for creating Ordering instances.
When a test class is annotated with @OrderWith or extends a class annotated with @OrderWith, JUnit will order the tests in the test class (and child test classes, if any) using the ordering defined by the Ordering class.
Validates that there are no errors in the use of the OrderWith annotation.
 
The custom runner Parameterized implements parameterized tests.
Annotation for public static void methods which should be executed after evaluating tests with particular parameters.
Annotation for public static void methods which should be executed before evaluating tests with particular parameters.
Annotation for fields of the test class which will be initialized by the method annotated by Parameters.
Annotation for a method which provides parameters to be injected into the test class constructor by Parameterized.
Add this annotation to your test class if you want to generate a special runner.
 
A ParametersRunnerFactory creates a runner for a single TestWithParameters.
Annotating a Theory method parameter with @ParametersSuppliedBy causes it to be supplied with values from the named ParameterSupplier when run as a theory by the Theories runner.
Abstract parent class for suppliers of input data points for theories.
Provides most of the functionality specific to a Runner that implements a "parent node" in the test tree, with children defined by objects of some data type T.
 
 
A test result that prints nicely in error messages.
Validates that a TestClass is public.
A Request is an abstract description of tests to be run.
A Result collects and summarizes information from running multiple tests.
Matchers on a PrintableResult, to enable JUnit self-tests.
Annotates fields that reference rules or methods that return a rule.
The RuleChain can be used for creating composite rules.
Register an instance of this class with RunNotifier to be notified of events that occur during a test run.
Indicates a RunListener that can have its methods called concurrently.
A Runner runs tests and notifies a RunNotifier of significant events as it does so.
A RunnerBuilder is a strategy for constructing runners for classes.
Represents a strategy for scheduling when individual test methods should be run (in serial or parallel) WARNING: still experimental, may go away.
If you write custom runners, you may need to notify JUnit of your progress running tests.
Runs a collection of rules on a statement.
When a class is annotated with @RunWith or extends a class annotated with @RunWith, JUnit will invoke the class it references to run the tests in that class instead of the runner built into JUnit.
Interface for runners that allow sorting of tests.
A Sorter orders tests.
Represents one or more actions to be taken at runtime in the course of running a JUnit test suite.
Thrown when a user has requested that the test run stop.
The Stopwatch Rule notifies one of its own protected methods of the time spent by a test.
Using Suite as a runner allows you to manually build a suite containing tests from many classes.
The SuiteClasses annotation specifies the classes to be run when a class annotated with @RunWith(Suite.class) is run.
The TemporaryFolder Rule allows creation of files and folders that should be deleted when the test method finishes (whether it passes or fails).
Builds an instance of TemporaryFolder.
The Test annotation tells JUnit that the public void method to which it is attached can be run as a test case.
Default empty exception.
Wraps a class to be run, providing method validation and annotation searching
Validates a single facet of a test class.
Indicates that a test that indicated that it should be skipped could not be skipped.
Annotating a Theory method int parameter with @TestedOn causes it to be supplied with values from the ints array given when run as a theory by the Theories runner.
 
The TestName Rule makes the current test name available inside test methods:
A TestRule is an alteration in how a test method, or set of test methods, is run and reported.
Exception thrown when a test fails on timeout.
TestWatcher is a base class for Rules that take note of the testing action, without modifying it.
Deprecated.
Use TestWatcher (which implements TestRule) instead.
A TestWithParameters keeps the data together that are needed for creating a runner for a single data set of a parameterized test.
The Theories runner allows to test a certain functionality against a subset of an infinite set of data points.
 
Marks test methods that should be read as theories by the Theories runner.
This interface facilitates the use of Assert.assertThrows(Class, ThrowingRunnable) from Java 8.
The Timeout Rule applies the same timeout to all test methods in a class:
Builder for Timeout.
Allows for an AnnotationValidator to be attached to an annotation.
Verifier is a base class for Rules like ErrorCollector, which can turn otherwise passing test methods into failing tests if a verification check is failed