Пример #1
0
  public TestAll(String packageRoot, String... classRoots)
      throws IOException, ClassNotFoundException {
    myTestCaseLoader =
        new TestCaseLoader((ourMode & FILTER_CLASSES) != 0 ? "tests/testGroups.properties" : "");
    myTestCaseLoader.addFirstTest(Class.forName("_FirstInSuiteTest"));
    myTestCaseLoader.addLastTest(Class.forName("_LastInSuiteTest"));

    fillTestCases(myTestCaseLoader, packageRoot, classRoots);
  }
Пример #2
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);
 }
Пример #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;
  }
Пример #4
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();
  }