当前位置: 首页>>代码示例>>Java>>正文


Java TestResult.failureCount方法代码示例

本文整理汇总了Java中junit.framework.TestResult.failureCount方法的典型用法代码示例。如果您正苦于以下问题:Java TestResult.failureCount方法的具体用法?Java TestResult.failureCount怎么用?Java TestResult.failureCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在junit.framework.TestResult的用法示例。


在下文中一共展示了TestResult.failureCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:NbModuleSuite.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:TimeOutTest.java

示例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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:LinearSpeedTest.java

示例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()));
}
 
开发者ID:eclipse,项目名称:cft,代码行数:12,代码来源:ManagedTestSuite.java

示例5: main

import junit.framework.TestResult; //导入方法依赖的package包/类
/**
 * Provides the main entry point. First and second argument are class and
 * method name, respectively. Third argument is the temporary file name for
 * the result. Exits with one of the usual JUnit exit values.
 */
public static void main(String args[]) {
    Logger.global.setLevel(Level.OFF);

    CoreTestIsolator testRunner = new CoreTestIsolator();
    try {
        TestResult r = testRunner.start(args);

        if (!r.wasSuccessful()) {
            // Store failure or error - we know there must be one
            Throwable failure = r.failureCount() != 0 ?
                    ((TestFailure)r.failures().nextElement()).
                            thrownException() :
                    ((TestFailure)r.errors().nextElement()).
                            thrownException();

            saveStackTrace(failure, args[2]);

            System.exit(FAILURE_EXIT);
        } else {
            // Nothing to see here, please get along
            System.exit(SUCCESS_EXIT);
        }
    } catch(Exception e) {
        // Let main TestRunner know about execution problem
        saveStackTrace(e, args[2]);
        System.exit(EXCEPTION_EXIT);
    }

}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:35,代码来源:CoreTestIsolator.java

示例6: runWithResult

import junit.framework.TestResult; //导入方法依赖的package包/类
public void runWithResult() {

        TestResult result   = run();
        String     testName = this.getClass().getName();

        if (testName.startsWith("org.hsqldb.test.")) {
            testName = testName.substring(16);
        }

        testName += "." + getName();

        int failureCount = result.failureCount();

        System.out.println(testName + " failure count: " + failureCount);

        java.util.Enumeration failures = result.failures();

        while (failures.hasMoreElements()) {
            System.err.println(failures.nextElement());
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:22,代码来源:TestBase.java


注:本文中的junit.framework.TestResult.failureCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。