All Classes
-
All Classes Interface Summary Class Summary Enum Summary Exception Summary Error Summary Annotation Types Summary Class Description After If you allocate external resources in aBefore
method you need to release them after the test runs.AfterClass If you allocate expensive external resources in aBeforeClass
method you need to release them after all the tests in the class have run.AllTests Runner for use with JUnit 3.8.x-style AllTests classes (those that only implement a staticsuite()
method).Assert A set of assertion methods useful for writing tests.Assume A set of methods useful for stating assumptions about the conditions in which a test is meaningful.Before When writing tests, it is common to find that several tests need similar objects created before they can run.BeforeClass Sometimes several tests need to share computationally expensive setup (like logging into a database).BlockJUnit4ClassRunner Implements the JUnit 4 standard test case class model, as defined by the annotations in the org.junit package.Categories 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.Categories.CategoryFilter Categories.ExcludeCategory Categories.IncludeCategory Category Marks a test class or test method as belonging to one or more categories of tests.ClassRule Annotates static fields that reference rules or methods that return them.ComparisonFailure Thrown when anassertEquals(String, String)
fails.Computer Represents a strategy for computing runners and suites.CouldNotReadCoreException Thrown when Max cannot read the MaxCore serializationDataPoint DataPoints Describable Represents an object that can describe itselfDescription ADescription
describes a test which is to be run or has been run.Enclosed If you put tests in inner classes, Ant, for example, won't find them.ErrorCollector 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):ExpectedException The ExpectedException rule allows in-test specification of expected exception types and messages:ExternalResource 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:Failure AFailure
holds a description of the failed test and the exception that was thrown while running it.Filter The canonical case of filtering is when you want to run a single test method in a class.Filterable Runners that allow filtering should implement this interface.FixMethodOrder This class allows the user to choose the order of execution of the methods within a test class.FrameworkField Represents a field on a test class (currently used only for Rules inBlockJUnit4ClassRunner
, but custom runners can make other uses)FrameworkMember<T extends FrameworkMember<T>> Parent class forFrameworkField
andFrameworkMethod
FrameworkMethod Represents a method on a test class to be invoked at the appropriate point in test execution.Ignore Sometimes you want to temporarily disable a test or a group of tests.InitializationError Represents one or more problems encountered while initializing a RunnerJUnit4 Aliases the current default JUnit 4 class runner, for future-proofing.JUnitCore JUnitCore
is a facade for running tests.JUnitMatchers 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.MaxCore 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.MaxHistory Stores a subset of the history of each test: Last failure timestamp Duration of last executionMethodRule A MethodRule is an alteration in how a test method is run and reported.MethodSorters Sort the methods into a specified execution order.MultipleFailureException Collects multipleThrowable
s into one exception.NoTestsRemainException Thrown when a filter removes all tests from a runner.ParallelComputer Parameterized The custom runnerParameterized
implements parameterized tests.Parameterized.Parameter Annotation for fields of the test class which will be initialized by the method annotated byParameters
By using directly this annotation, the test class constructor isn't needed.
Index range must start at 0.Parameterized.Parameters Annotation for a method which provides parameters to be injected into the test class constructor byParameterized
ParameterSignature ParametersSuppliedBy ParameterSupplier ParentRunner<T> 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 typeT
.PotentialAssignment PotentialAssignment.CouldNotGenerateValueException PrintableResult A test result that prints nicely in error messages.Request ARequest
is an abstract description of tests to be run.Result AResult
collects and summarizes information from running multiple tests.ResultMatchers Matchers on a PrintableResult, to enable JUnit self-tests.Rule Annotates fields that reference rules or methods that return a rule.RuleChain The RuleChain rule allows ordering of TestRules.RunListener If you need to respond to the events during a test run, extendRunListener
and override the appropriate methods.Runner ARunner
runs tests and notifies aRunNotifier
of significant events as it does so.RunnerBuilder A RunnerBuilder is a strategy for constructing runners for classes.RunnerScheduler Represents a strategy for scheduling when individual test methods should be run (in serial or parallel) WARNING: still experimental, may go away.RunNotifier If you write custom runners, you may need to notify JUnit of your progress running tests.RunRules Runs a collection of rules on a statement.RunWith 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.Sortable Interface for runners that allow sorting of tests.Sorter ASorter
orders tests.Statement Represents one or more actions to be taken at runtime in the course of running a JUnit test suite.StoppedByUserException Thrown when a user has requested that the test run stop.Suite UsingSuite
as a runner allows you to manually build a suite containing tests from many classes.Suite.SuiteClasses TheSuiteClasses
annotation specifies the classes to be run when a class annotated with@RunWith(Suite.class)
is run.TemporaryFolder The TemporaryFolder Rule allows creation of files and folders that are guaranteed to be deleted when the test method finishes (whether it passes or fails):Test TheTest
annotation tells JUnit that thepublic void
method to which it is attached can be run as a test case.Test.None Default empty exceptionTestClass Wraps a class to be run, providing method validation and annotation searchingTestedOn TestedOnSupplier TestName The TestName Rule makes the current test name available inside test methods:TestRule A TestRule is an alteration in how a test method, or set of test methods, is run and reported.TestWatcher TestWatcher is a base class for Rules that take note of the testing action, without modifying it.TestWatchman Deprecated. UseTestWatcher
(which implementsTestRule
) instead.Theories Theories.TheoryAnchor Theory Timeout The Timeout Rule applies the same timeout to all test methods in a class:Verifier 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