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


Java Result.getFailureCount方法代码示例

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


在下文中一共展示了Result.getFailureCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runTestSuiteAgainst

import org.junit.runner.Result; //导入方法依赖的package包/类
/**
 * Creates and runs a JUnit test runner for testSuite.
 *
 * @param testSuite the class defining test cases to run
 * @param view a UI component to report test failures to
 * @return the counts of failures and total test cases.
 */
static RunResult runTestSuiteAgainst(Class testSuite, View view)
{
    if(testSuite == null)
        throw new NullPointerException("testSuite");

    if(view == null)
        throw new NullPointerException("view");

    Result result = new JUnitCore().run(testSuite);

    if (result.getFailureCount() > 0)
    {
        for (Failure f : result.getFailures())
            view.declarePassProgramTestFailure(f.getTrace());
    }


    return new RunResult(result.getFailureCount(), result.getRunCount());
}
 
开发者ID:capergroup,项目名称:bayou,代码行数:27,代码来源:TestSuiteRunner.java

示例2: 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

示例3: testRunFailed

import org.junit.runner.Result; //导入方法依赖的package包/类
private void testRunFailed(final Result result) {

        if (result.getFailureCount() > 1) {
            printlnError(result.getFailureCount() + " test cases failed.");
        } else {
            printlnError("1 test case failed.");
        }

        printIgnoredTestCases(result);

    }
 
开发者ID:galop-proxy,项目名称:galop,代码行数:12,代码来源:ExecutionListener.java

示例4: TestResult

import org.junit.runner.Result; //导入方法依赖的package包/类
public TestResult(Result result) {
    runCount = result.getRunCount();
    failureCount = result.getFailureCount();
    ignoreCount = result.getIgnoreCount();
    runTime = result.getRunTime();
    if (!wasSuccessful()) {
        throwable = result.getFailures().get(0).getException();
    }
}
 
开发者ID:blackboard,项目名称:lambda-selenium,代码行数:10,代码来源:TestResult.java

示例5: main

import org.junit.runner.Result; //导入方法依赖的package包/类
public static void main(String[] argv) {
    JUnitCore junit = new JUnitCore();
    Result result = null;
    result = junit.run(Request.method(TestParser.class, "malformedTest4"));
    if (result.getFailureCount() > 0) {
        for (Failure failure : result.getFailures()) {
            failure.getException().printStackTrace();
        }
    }
    System.exit(0);

}
 
开发者ID:junicorn,项目名称:NiuBi,代码行数:13,代码来源:TestParser.java

示例6: run

import org.junit.runner.Result; //导入方法依赖的package包/类
/**
 * Parses "trials.xml" as found as a resource on the current class path and executes the trials against
 * the given Synthesizer reporting progress to the given View.
 *
 * Expects a trialpack to be on the current classpath.
 *
 * @param synthesizer the Synthesizer to use for creating programs from draft programs identified in trials.
 * @param view the UI component for reporting execution progress.
 * @throws IOException if there is a program reading resources (like "trails.xml") on the classpath.
 * @throws ParseException if "trials.xml" is not of the expected format
 * @throws ClassCastException if "PassProgram" or "PassProgramTest" cannot be loaded from teh current classpath.
 */
void run(Synthesizer synthesizer, View view) throws IOException, ParseException, ClassNotFoundException
{
    if(synthesizer == null)
        throw new NullPointerException("synthesizer");

    if(view == null)
        throw new NullPointerException("view");

    /*
     * Parse trials.xml from inside the trialpack (assumed to be on classpath) into a Directive structure.
     */
    Directive directive;
    {
        //  We expect the trialpack jar file to be on the classpath.  That jar file should have a
        //  trails.xml file its root directory.  So look for it at just "trails.xml" path.
        String trailsXml = new String(getResource("trials.xml"), StandardCharsets.UTF_8);
        directive = DirectiveXmlV1Parser.makeDefault().parse(trailsXml);
    }

    /*
     * Test the test suite by asserting that all test cases pass when given the pass program.
     *
     * Stop the program if this is not the case.
     */
    // expect PassProgram class inside the trailpack which is assumed to be on the class path
    Class passProgram = getClass().getClassLoader().loadClass("PassProgram");
    // expect PassProgramTest class inside the trailpack which is assumed to be on the class path
    Class passProgramTestSuite = getClass().getClassLoader().loadClass("PassProgramTest");

    view.declareTestingTestSuite(passProgramTestSuite, passProgram);

    Result result = new JUnitCore().run(passProgramTestSuite); // run the test cases against PassProgram
    view.declareNumberOfTestCasesInSuite(result.getRunCount());

    if(result.getFailureCount() > 0) // if the pass program did not pass the test suite
    {
        for (Failure f : result.getFailures())
            view.declarePassProgramTestFailure(f.getTrace());
    }
    else // pass program did pass the test suite, proceed to running the user specified trials
    {
        List<Trial> trials = makeTrials(directive, DraftBuilderBayou1_1_0::new);
        TrialsRunner.runTrails(trials, synthesizer, view);
    }

}
 
开发者ID:capergroup,项目名称:bayou,代码行数:59,代码来源:FloodGage.java


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