本文整理汇总了Java中junit.framework.TestResult.errorCount方法的典型用法代码示例。如果您正苦于以下问题:Java TestResult.errorCount方法的具体用法?Java TestResult.errorCount怎么用?Java TestResult.errorCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类junit.framework.TestResult
的用法示例。
在下文中一共展示了TestResult.errorCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runTest
import junit.framework.TestResult; //导入方法依赖的package包/类
@Override
public void runTest(Test test, TestResult result) {
int e = result.errorCount();
int f = result.failureCount();
LOG.log(Level.FINE, "Running test {0}", test);
super.runTest(test, result);
LOG.log(Level.FINE, "Finished: {0}", test);
if (e == result.errorCount() && f == result.failureCount()) {
NbModuleLogHandler.checkFailures((TestCase) test, result, test instanceof NbTestCase ? ((NbTestCase) test).getWorkDirPath() : Manager.getWorkDirPath());
}
}
示例2: run
import junit.framework.TestResult; //导入方法依赖的package包/类
public void run(TestResult result) {
if (!canRun()) {
return;
}
this.main = Thread.currentThread();
TestResult mine = new TestResult();
result.startTest(this);
super.run(mine);
if (mine.errorCount() != 0) {
Enumeration en = mine.errors();
while(en.hasMoreElements()) {
TestFailure f = (TestFailure)en.nextElement();
result.addError(this, f.thrownException());
}
return;
}
if (expectedResult != (mine.failureCount() == 0)) {
result.addFailure(this,
new AssertionFailedError(
"expectedResult: " + expectedResult + "failureCount: " + mine.failureCount() + " for " + getName()
)
);
return;
}
result.endTest(this);
}
示例3: suite
import junit.framework.TestResult; //导入方法依赖的package包/类
public static Test suite() {
System.setProperty("ignore.random.failures", "false");
final Test t = NbTestSuite.linearSpeedSuite(LinearSpeedTest.class, 2,2);
class ThisHasToFail extends TestCase {
public int countTestCases() {
return 1;
}
public String getName() {
return "LinearSpeedTest";
}
public void run(TestResult testResult) {
TestResult r = new TestResult();
t.run(r);
int count = r.errorCount() + r.failureCount();
if (count == 0) {
testResult.startTest(this);
testResult.addFailure(this, new AssertionFailedError("LinearSpeedTest must fail: " + count));
testResult.endTest(this);
} else {
testResult.startTest(this);
testResult.endTest(this);
}
}
}
return new ThisHasToFail();
}
示例4: dumpResults
import junit.framework.TestResult; //导入方法依赖的package包/类
public void dumpResults(TestResult result) {
System.err.println();
dumpList("Failures: ", result.failures());
System.err.println();
dumpList("Errors: ", result.errors());
int failedCount = result.errorCount() + result.failureCount();
System.err.println();
System.err.println(MessageFormat.format("{0} out of {1} tests failed", failedCount, result.runCount()));
}