Java Code Examples for org.junit.runner.Result#getRunTime()

The following examples show how to use org.junit.runner.Result#getRunTime() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Outcome.java    From SimFix with GNU General Public License v2.0 6 votes vote down vote up
public Outcome(Result result, String digest_) {
  // Constructs an Outcome from a JUnit result.
  // Only PASS/FAIL outcomes can be made this way: if a test times out
  // or crashes the JVM, there won't be a JUnit result to base the Outcome on.
  // In those cases, use createTimeout or createCrash.
  digest = digest_;
  coveredMutants = new ArrayList<Integer>();
  if (result.wasSuccessful()) {
    type = Type.PASS;
    runTime = result.getRunTime();
    stackTrace = "";
  } else {
    type = Type.FAIL;
    runTime = result.getRunTime();
    stackTrace = normalizeStackTrace(result.getFailures().get(0).getTrace());
  }
}
 
Example 2
Source File: Tracker.java    From usergrid with Apache License 2.0 6 votes vote down vote up
public Result execute() {
    Preconditions.checkState( isStarted.get(), "Cannot execute a tracker that has not started!" );

    Result result = new JUnitCore().run( testClass );
    long runTime = result.getRunTime();

    // collect some statistics
    maxTime = Math.max( maxTime, runTime );
    minTime = Math.min( minTime, runTime );
    long timesRun = actualIterations.incrementAndGet();
    long totalTime = totalRunTime.addAndGet( runTime );
    totalTestsRun.addAndGet( result.getRunCount() );
    meanTime = totalTime / timesRun;

    if ( ! result.wasSuccessful() ) {
        failures.addAndGet( result.getFailureCount() );
        ignores.addAndGet( result.getIgnoreCount() );
    }
    resultsLog.write( result );
    return result;
}
 
Example 3
Source File: UnitTestResult.java    From camel-spring-boot with Apache License 2.0 5 votes vote down vote up
public UnitTestResult(Result jr) {
    this.runCount = jr.getRunCount();
    this.failureCount = jr.getFailureCount();
    this.runTime = jr.getRunTime();
    this.ignoreCount = jr.getIgnoreCount();
    this.successful = jr.wasSuccessful();
}
 
Example 4
Source File: TestResult.java    From lambda-selenium with MIT License 5 votes vote down vote up
public TestResult(Result result) {
    runCount = result.getRunCount();
    failureCount = result.getFailureCount();
    ignoreCount = result.getIgnoreCount();
    runTime = result.getRunTime();
    if (!wasSuccessful()) {
        throwable = result.getFailures().get(0).getException();
    }
}
 
Example 5
Source File: CompoundResult.java    From nopol with GNU General Public License v2.0 5 votes vote down vote up
@Override
public long getRunTime() {
    long total = 0;
    for (Result result : results()) {
        total += result.getRunTime();
    }
    return total;
}