/** * Create a new MaxCore from a serialized file stored at storedResults */ public static MaxCore storedLocally(File storedResults) { return new MaxCore(storedResults); }
private Request constructLeafRequest(List<Description> leaves) { final List<Runner> runners = new ArrayList<Runner>(); for (Description each : leaves) { runners.add(buildRunner(each)); } return new Request() { @Override public Runner getRunner() { try { return new Suite((Class<?>) null, runners) { }; } catch (InitializationError e) { return new ErrorReportingRunner(null, e); } } }; }
/** * @return a new Request, which contains all of the same tests, but in a new order. */ public Request sortRequest(Request request) { if (request instanceof SortingRequest) { // We'll pay big karma points for this return request; } List<Description> leaves = findLeaves(request); Collections.sort(leaves, history.testComparator()); return constructLeafRequest(leaves); }
/** * @param request a request to run * @return a list of method-level tests to run, sorted in the order * specified in the class comment. */ public List<Description> sortedLeavesForTest(Request request) { return findLeaves(sortRequest(request)); }
/** * Run all the tests in <code>class</code>. * * @return a {@link Result} describing the details of the test run and the failed tests. */ public Result run(Class<?> testClass) { return run(Request.aClass(testClass)); }
private List<Description> findLeaves(Request request) { List<Description> results = new ArrayList<Description>(); findLeaves(null, request.getRunner().getDescription(), results); return results; }
/** * Create a new MaxCore from a serialized file stored at storedResults * * @deprecated use storedLocally() */ @Deprecated public static MaxCore forFolder(String folderName) { return storedLocally(new File(folderName)); }
/** * Run all the tests contained in <code>request</code>. * * This variant should be used if {@code core} has attached listeners that this * run should notify. * * @param request the request describing tests * @param core a JUnitCore to delegate to. * @return a {@link Result} describing the details of the test run and the failed tests. */ public Result run(Request request, JUnitCore core) { core.addListener(history.listener()); return core.run(sortRequest(request).getRunner()); }
private Runner buildRunner(Description each) { if (each.toString().equals("TestSuite with 0 tests")) { return Suite.emptySuite(); } if (each.toString().startsWith(MALFORMED_JUNIT_3_TEST_CLASS_PREFIX)) { // This is cheating, because it runs the whole class // to get the warning for this method, but we can't do better, // because JUnit 3.8's // thrown away which method the warning is for. return new JUnit38ClassRunner(new TestSuite(getMalformedTestClass(each))); } Class<?> type = each.getTestClass(); if (type == null) { throw new RuntimeException("Can't build a runner from description [" + each + "]"); } String methodName = each.getMethodName(); if (methodName == null) { return Request.aClass(type).getRunner(); } return Request.method(type, methodName).getRunner(); }
/** * @param request a request to run * @return a list of method-level tests to run, sorted in the order * specified in the class comment. */ public List<Description> sortedLeavesForTest(Request request) { return findLeaves(sortRequest(request)); }
/** * Run all the tests contained in <code>request</code>. * * @param request the request describing tests * @return a {@link Result} describing the details of the test run and the failed tests. */ public Result run(Request request) { return run(request, new JUnitCore()); }
private List<Description> findLeaves(Request request) { List<Description> results = new ArrayList<Description>(); findLeaves(null, request.getRunner().getDescription(), results); return results; }
/** * Create a new MaxCore from a serialized file stored at storedResults * * @deprecated use storedLocally() */ @Deprecated public static MaxCore forFolder(String folderName) { return storedLocally(new File(folderName)); }
/** * Run all the tests contained in <code>request</code>. * * This variant should be used if {@code core} has attached listeners that this * run should notify. * * @param request the request describing tests * @param core a JUnitCore to delegate to. * @return a {@link Result} describing the details of the test run and the failed tests. */ public Result run(Request request, JUnitCore core) { core.addListener(fHistory.listener()); return core.run(sortRequest(request).getRunner()); }
private Runner buildRunner(Description each) { if (each.toString().equals("TestSuite with 0 tests")) { return Suite.emptySuite(); } if (each.toString().startsWith(MALFORMED_JUNIT_3_TEST_CLASS_PREFIX)) { // This is cheating, because it runs the whole class // to get the warning for this method, but we can't do better, // because JUnit 3.8's // thrown away which method the warning is for. return new JUnit38ClassRunner(new TestSuite(getMalformedTestClass(each))); } Class<?> type = each.getTestClass(); if (type == null) { throw new RuntimeException("Can't build a runner from description [" + each + "]"); } String methodName = each.getMethodName(); if (methodName == null) { return Request.aClass(type).getRunner(); } return Request.method(type, methodName).getRunner(); }
/** * @return a new Request, which contains all of the same tests, but in a new order. */ public Request sortRequest(Request request) { if (request instanceof SortingRequest) { // We'll pay big karma points for this return request; } List<Description> leaves = findLeaves(request); Collections.sort(leaves, fHistory.testComparator()); return constructLeafRequest(leaves); }
/** * @param request a request to run * @return a list of method-level tests to run, sorted in the order * specified in the class comment. */ public List<Description> sortedLeavesForTest(Request request) { return findLeaves(sortRequest(request)); }
/** * Run all the tests in <code>class</code>. * * @return a {@link Result} describing the details of the test run and the failed tests. */ public Result run(Class<?> testClass) { return run(Request.aClass(testClass)); }
private void findLeaves(Description parent, Description description, List<Description> results) { if (description.getChildren().isEmpty()) { if (description.toString().equals("warning(junit.framework.TestSuite$1)")) { results.add(Description.createSuiteDescription(MALFORMED_JUNIT_3_TEST_CLASS_PREFIX + parent)); } else { results.add(description); } } else { for (Description each : description.getChildren()) { findLeaves(description, each, results); } } } }
/** * Create a new MaxCore from a serialized file stored at storedResults */ public static MaxCore storedLocally(File storedResults) { return new MaxCore(storedResults); }