예제 #1
0
  @Override
  public void doCommand(String... args)
      throws CommandArgumentsException, CommandOperationException {
    validateArguments(args);
    File testRoot = getTestRoot(args);
    WebDriverProvider.setBaseUrl(getUrl(args));

    TestCompiler testCompiler = new TestCompiler();

    out.println("Running integration tests in " + testRoot.getPath());
    out.println("Running integration tests using root URL: " + WebDriverProvider.getBaseUrl(""));
    out.println("");

    File classesRoot = null;
    try {
      classesRoot = testCompiler.getClassesRoot(testRoot);
    } catch (IOException ex) {
      throw new CommandOperationException("Error creating directory for compiled tests.", ex);
    }
    if (classesRoot.exists()) {
      FileUtils.deleteQuietly(classesRoot);
    }

    List<File> testContainerDirs =
        new IntegrationTestFinder().findTestContainerDirs(testRoot, ignoreWorkbenches(args));
    if (testContainerDirs.size() < 1) {
      throw new CommandOperationException("No tests found.");
    }
    out.println("Found tests in " + testContainerDirs.size() + " location(s).");

    List<File> classDirs = testCompiler.compileTestDirs(testContainerDirs);

    List<Class<?>> testClasses = testCompiler.loadClasses(classDirs);

    Result testResult = null;
    try {
      File runnerConf = TestRunnerConfLocator.getTestRunnerConf();
      testResult = new IntegrationTestRunner().runTests(runnerConf, testClasses);
    } catch (Exception ex) {
      throw new CommandOperationException(ex);
    }

    printTestReport(testResult);
    if (testResult.getFailures().size() > 0) {
      throw new CommandOperationException("There were failing tests.");
    }
  }
예제 #2
0
 public static Test suite() {
   TestSuite suite = new TestSuite();
   suite.addTest(TestUTCProvider.suite());
   suite.addTest(TestBuilder.suite());
   suite.addTest(TestCompiler.suite());
   suite.addTest(TestCachedDateTimeZone.suite());
   suite.addTest(TestFixedDateTimeZone.suite());
   return suite;
 }