本文整理匯總了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;
}
示例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);
}
示例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...");
}
}
示例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);
}
示例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);
}
}
示例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");
}
示例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());
}
示例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());
}
示例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;
}