本文整理汇总了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;
}