예제 #1
0
 @Override
 public void run(final TestResult testResult) {
   List<Class> classes = myTestCaseLoader.getClasses();
   int totalTests = classes.size();
   for (final Class aClass : classes) {
     runNextTest(testResult, totalTests, aClass);
     if (testResult.shouldStop()) break;
   }
   tryGc(10);
 }
예제 #2
0
  public static void fillTestCases(
      TestCaseLoader testCaseLoader, String packageRoot, String... classRoots) throws IOException {
    for (String classRoot : classRoots) {
      int oldCount = testCaseLoader.getClasses().size();
      ClassFinder classFinder =
          new ClassFinder(new File(FileUtil.toSystemDependentName(classRoot)), packageRoot);
      testCaseLoader.loadTestCases(classFinder.getClasses());
      int newCount = testCaseLoader.getClasses().size();
      if (newCount != oldCount) {
        System.out.println(
            "Loaded " + (newCount - oldCount) + " tests from class root " + classRoot);
      }
    }

    if (testCaseLoader.getClasses().size() == 1) {
      testCaseLoader.clearClasses();
    }

    log("Number of test classes found: " + testCaseLoader.getClasses().size());
    testCaseLoader.checkClassesExist();
  }
예제 #3
0
  @Override
  public int countTestCases() {
    List<Class> classes = myTestCaseLoader.getClasses();

    int count = 0;

    for (final Object aClass : classes) {
      Class testCaseClass = (Class) aClass;
      Test test = getTest(testCaseClass);
      if (test != null) count += test.countTestCases();
    }

    return count;
  }