Package org.junit.experimental.max
Class MaxCore
- java.lang.Object
-
- org.junit.experimental.max.MaxCore
-
public class MaxCore extends java.lang.ObjectA 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. The rules for sorting are:- Never-run tests first, in arbitrary order
- Group remaining tests by the date at which they most recently failed.
- Sort groups such that the most recent failure date is first, and never-failing tests are at the end.
- Within a group, run the fastest tests first.
-
-
Field Summary
Fields Modifier and Type Field Description private MaxHistoryhistoryprivate static java.lang.StringMALFORMED_JUNIT_3_TEST_CLASS_PREFIX
-
Constructor Summary
Constructors Modifier Constructor Description privateMaxCore(java.io.File storedResults)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private RunnerbuildRunner(Description each)private RequestconstructLeafRequest(java.util.List<Description> leaves)private voidfindLeaves(Description parent, Description description, java.util.List<Description> results)private java.util.List<Description>findLeaves(Request request)static MaxCoreforFolder(java.lang.String folderName)Deprecated.use storedLocally()private java.lang.Class<?>getMalformedTestClass(Description each)Resultrun(java.lang.Class<?> testClass)Run all the tests inclass.Resultrun(Request request)Run all the tests contained inrequest.Resultrun(Request request, JUnitCore core)Run all the tests contained inrequest.java.util.List<Description>sortedLeavesForTest(Request request)RequestsortRequest(Request request)static MaxCorestoredLocally(java.io.File storedResults)Create a new MaxCore from a serialized file stored at storedResults
-
-
-
Field Detail
-
MALFORMED_JUNIT_3_TEST_CLASS_PREFIX
private static final java.lang.String MALFORMED_JUNIT_3_TEST_CLASS_PREFIX
- See Also:
- Constant Field Values
-
history
private final MaxHistory history
-
-
Method Detail
-
forFolder
@Deprecated public static MaxCore forFolder(java.lang.String folderName)
Deprecated.use storedLocally()Create a new MaxCore from a serialized file stored at storedResults
-
storedLocally
public static MaxCore storedLocally(java.io.File storedResults)
Create a new MaxCore from a serialized file stored at storedResults
-
run
public Result run(java.lang.Class<?> testClass)
Run all the tests inclass.- Returns:
- a
Resultdescribing the details of the test run and the failed tests.
-
run
public Result run(Request request)
Run all the tests contained inrequest.- Parameters:
request- the request describing tests- Returns:
- a
Resultdescribing the details of the test run and the failed tests.
-
run
public Result run(Request request, JUnitCore core)
Run all the tests contained inrequest. This variant should be used ifcorehas attached listeners that this run should notify.- Parameters:
request- the request describing testscore- a JUnitCore to delegate to.- Returns:
- a
Resultdescribing the details of the test run and the failed tests.
-
sortRequest
public Request sortRequest(Request request)
- Returns:
- a new Request, which contains all of the same tests, but in a new order.
-
constructLeafRequest
private Request constructLeafRequest(java.util.List<Description> leaves)
-
buildRunner
private Runner buildRunner(Description each)
-
getMalformedTestClass
private java.lang.Class<?> getMalformedTestClass(Description each)
-
sortedLeavesForTest
public java.util.List<Description> sortedLeavesForTest(Request request)
- Parameters:
request- a request to run- Returns:
- a list of method-level tests to run, sorted in the order specified in the class comment.
-
findLeaves
private java.util.List<Description> findLeaves(Request request)
-
findLeaves
private void findLeaves(Description parent, Description description, java.util.List<Description> results)
-
-