當前位置: 首頁>>代碼示例>>Java>>正文


Java Result.wasSuccessful方法代碼示例

本文整理匯總了Java中org.junit.runner.Result.wasSuccessful方法的典型用法代碼示例。如果您正苦於以下問題:Java Result.wasSuccessful方法的具體用法?Java Result.wasSuccessful怎麽用?Java Result.wasSuccessful使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.junit.runner.Result的用法示例。


在下文中一共展示了Result.wasSuccessful方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: merge

import org.junit.runner.Result; //導入方法依賴的package包/類
/**
 * Updates the current state of <code>this</code> with the <code>result</code>.
 *
 * @param testClass The test class executed.
 * @param result The results of the test class execution.
 * @return <code>this</code>
 */
public TestResults merge(Class<?> testClass, Result result) {
  LOG.info("Tests run: {}, Failures: {}, Skipped: {}, Time elapsed: {} - in {}",
      result.getRunCount(), result.getFailureCount(), result.getIgnoreCount(),
      TimeUnit.SECONDS.convert(result.getRunTime(), TimeUnit.MILLISECONDS),
      testClass.getName());

  numRun += result.getRunCount();
  numFailed += result.getFailureCount();
  numIgnored += result.getIgnoreCount();

  // Collect the failures
  if (!result.wasSuccessful()) {
    failures.addAll(result.getFailures());
  }

  return this;
}
 
開發者ID:apache,項目名稱:calcite-avatica,代碼行數:25,代碼來源:TestRunner.java

示例2: main

import org.junit.runner.Result; //導入方法依賴的package包/類
/**
 * .
 * @param args .
 * @throws ClassNotFoundException .
 */
public static void main(String... args) throws ClassNotFoundException {
    int retCode = 0;
    String resultMessage = "SUCCESS";
    String[] classAndMethod = args[0].split("#");
    Request request = Request.method(Class.forName(classAndMethod[0]),
            classAndMethod[1]);

    Result result = new JUnitCore().run(request);
    if (!result.wasSuccessful()) {
        retCode = 1;
        resultMessage = "FAILURE";
    }
    System.out.println(resultMessage);
    System.exit(retCode);
}
 
開發者ID:personium,項目名稱:personium-core,代碼行數:21,代碼來源:SingleJUnitTestRunner.java

示例3: main

import org.junit.runner.Result; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    Result result = JUnitCore.runClasses(Bug_for_Next.class);
    for (Failure fail : result.getFailures()) {
        System.out.println(fail.toString());
    }
    if (result.wasSuccessful()) {
        System.out.println("All tests finished successfully...");
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:10,代碼來源:Bug_for_Next.java

示例4: main

import org.junit.runner.Result; //導入方法依賴的package包/類
public static void main(String[] args) {
  final Result result =
      JUnitCore.runClasses(
          codeu.chat.common.SecretTest.class,
          codeu.chat.relay.ServerTest.class,
          codeu.chat.server.BasicControllerTest.class,
          codeu.chat.server.RawControllerTest.class,
          codeu.chat.util.TimeTest.class,
          codeu.chat.util.UuidTest.class,
          codeu.chat.util.store.StoreTest.class,
          codeu.chat.util.TokenizerTest.class,
          codeu.chat.server.ControllerTest.class
      );

   System.out.println("\n===================== Test Status ====================");
   System.out.println(String.format("%d tests run.", result.getRunCount()));

   if (result.wasSuccessful()) {
     System.out.println("All tests passed.");
   } else {
     System.out.println(String.format("%d tests failed.", result.getFailureCount()));
     System.out.println("\nFailures:");
     for (final Failure failure : result.getFailures()) {
        System.out.println(failure.toString());
     }
   }

   System.out.println("======================================================\n");
   System.exit(result.wasSuccessful() ? 0 : -1);
}
 
開發者ID:EVelez79,項目名稱:CodeU-ProjectGroup6,代碼行數:31,代碼來源:TestRunner.java

示例5: runBatchMode

import org.junit.runner.Result; //導入方法依賴的package包/類
/**
 * Run Marathon in batch mode.
 */
private static void runBatchMode() {
    String projectDir = argProcessor.getProjectDirectory();
    if (projectDir == null) {
        argProcessor.help("No project directory");
        return;
    }
    if (!ProjectFile.isValidProjectDirectory(new File(projectDir))) {
        argProcessor.help("`" + projectDir + "` is an invalid project folder. Please provide a valid Marathon project folder.");
        return;
    }
    if (projectDir.endsWith(".mpf") && new File(projectDir).isFile()) {
        argProcessor.help("A marathon project file is given.\nUse project directory instead");
        return;
    }
    processMPF(projectDir, true);
    OSUtils.setLogConfiguration(projectDir);
    RuntimeLogger.setRuntimeLogger(new NullLogger());
    cleanResultFolder();
    TestRunner aTestRunner = createTestRunner();
    try {
        Result r = aTestRunner.runTests(argProcessor);
        if (!r.wasSuccessful()) {
            System.exit(junit.textui.TestRunner.FAILURE_EXIT);
        }
        System.exit(junit.textui.TestRunner.SUCCESS_EXIT);
    } catch (Exception e) {
        LOGGER.severe(e.getMessage());
        System.exit(junit.textui.TestRunner.EXCEPTION_EXIT);
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:34,代碼來源:RealMain.java

示例6: testRunFinished

import org.junit.runner.Result; //導入方法依賴的package包/類
@Override
public void testRunFinished(final Result result) throws Exception {

    println("\n");

    if (result.wasSuccessful()) {
        testRunSuccessful(result);
    } else {
        testRunFailed(result);
    }

    println("\n");

}
 
開發者ID:galop-proxy,項目名稱:galop,代碼行數:15,代碼來源:ExecutionListener.java

示例7: main

import org.junit.runner.Result; //導入方法依賴的package包/類
public static void main(String[] args) {
   Result result = JUnitCore.runClasses(TestSuite.class);

   for (Failure failure : result.getFailures()) {
      System.out.println(failure.toString());
   }
		
   if(result.wasSuccessful()){
 	  System.out.println("The tests all passed: " + result.wasSuccessful());
   }
   else System.err.println("The tests all passed: " + result.wasSuccessful());
}
 
開發者ID:asms,項目名稱:360w17g1,代碼行數:13,代碼來源:FullTestRunner.java

示例8: testRunFinished

import org.junit.runner.Result; //導入方法依賴的package包/類
@Override
public void testRunFinished(Result result) throws Exception {
    if (result.wasSuccessful()) {
        System.out.println(ansi().fgGreen().bold().a("\u2705 SUCCESS\t: all " + result.getRunCount() + " executed tests passed").reset());
    } else {
        System.out.println(ansi().fgRed().bold().a("\uD83D\uDED1 DAMN IT\t: " + result.getFailureCount() + " of " + result.getRunCount() + " executed tests failed").reset());
    }

    System.out.println(ansi().fgBrightBlack().bold().a("\uD83D\uDD57 TIME\t\t: test run took " + getElapsedTime(startTime) + " seconds (without maven ramp up)").reset());
}
 
開發者ID:christian-draeger,項目名稱:page-content-tester,代碼行數:11,代碼來源:TestListener.java

示例9: doWork

import org.junit.runner.Result; //導入方法依賴的package包/類
@Override
protected int doWork() throws Exception {
  //this is called from the command line, so we should set to use the distributed cluster
  IntegrationTestingUtility.setUseDistributedCluster(conf);
  Class<?>[] classes = findIntegrationTestClasses();
  LOG.info("Found " + classes.length + " integration tests to run:");
  for (Class<?> aClass : classes) {
    LOG.info("  " + aClass);
  }
  JUnitCore junit = new JUnitCore();
  junit.addListener(new TextListener(System.out));
  Result result = junit.run(classes);

  return result.wasSuccessful() ? 0 : 1;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:16,代碼來源:IntegrationTestsDriver.java


注:本文中的org.junit.runner.Result.wasSuccessful方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。