private String calculateTotalDurationString() { long totalDurationNanos = 0; for ( Result r : results ) { totalDurationNanos += r.getDuration() == null ? 0 : r.getDuration(); } for ( Result r : hookResults ) { totalDurationNanos += r.getDuration() == null ? 0 : r.getDuration(); } double totalDurationSeconds = ( (double) totalDurationNanos ) / 1000000000; return NUMBER_FORMAT.format( totalDurationSeconds ); }
/** Get the duration (in seconds) that the result took. */ static float durationFromResult(Result result) { // internally this is in nanosecodes Long l = result.getDuration(); if (l == null) { return 0.0f; } return l.floatValue() / 1000000000.0f; }
private void addHookToCounterAndResult(Result result) { scenarioResult.add(result); stats.addHookTime(result.getDuration()); } }
public void after(Match match, Result result) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "rep after match : " + match.getLocation()); LOG.log(Level.FINE, "rep result : " + "(passed) " + Result.PASSED.equals(result.getStatus())); LOG.log(Level.FINE, "rep result : " + result.getDuration()); LOG.log(Level.FINE, "rep result : " + result.getErrorMessage()); LOG.log(Level.FINE, "rep result : " + result.getError()); } currentScenarioResult.addAfterResult(new BeforeAfterResult(match, result)); }
public void before(Match match, Result result) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "rep before match: " + match.getLocation()); LOG.log(Level.FINE, "rep result : " + "(passed) " + Result.PASSED.equals(result.getStatus())); LOG.log(Level.FINE, "rep result : " + result.getDuration()); LOG.log(Level.FINE, "rep result : " + result.getErrorMessage()); LOG.log(Level.FINE, "rep result : " + result.getError()); } currentScenarioResult.addBeforeResult(new BeforeAfterResult(match, result)); }
public void result(Result result) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "rep result: " + "(passed) " + Result.PASSED.equals(result.getStatus())); LOG.log(Level.FINE, "rep " + result.getDuration()); LOG.log(Level.FINE, "rep " + result.getErrorMessage()); LOG.log(Level.FINE, "rep " + result.getError()); } StepResult stepResult = new StepResult(currentStep, currentMatch, result); if (currentBackground != null) { currentBackground.addStepResult(stepResult); } else { currentScenarioResult.addStepResult(stepResult); } currentStep = null; currentMatch = null; }
public Result result(Result result) { String errorMessage = result.getErrorMessage(); if (result.getStatus().equals(Result.FAILED)) { String errorString = FailureRenderer.render(null, null, result.getError()); StringBuilder builder = new StringBuilder(); for (String info : informationList) { builder.append(info); } builder.append(errorString); builder.append(getErrorMessage(result.getError())); errorMessage = builder.toString(); } else { String errorString = FailureRenderer.render(null, null); informationList.add(errorString); } return new Result(result.getStatus(), result.getDuration(), errorMessage); }
public ResultExec convertResult(Result result) { return new ResultExec( result.getStatus(), result.getError(), result.getErrorMessage(), result.getDuration()); }
protected void fireFixtureStep(final Match match, final Result result, final boolean isBefore) { final String uuid = md5(match.getLocation()); final StepResult stepResult = new StepResult() .setName(match.getLocation()) .setStatus(Status.fromValue(result.getStatus())) .setStart(System.currentTimeMillis() - result.getDuration()) .setStop(System.currentTimeMillis()); if (FAILED.equals(result.getStatus())) { final StatusDetails statusDetails = ResultsUtils.getStatusDetails(result.getError()).get(); stepResult.setStatusDetails(statusDetails); if (isBefore) { final TagParser tagParser = new TagParser(feature, scenario); statusDetails .setMessage("Before is failed: " + result.getError().getLocalizedMessage()) .setFlaky(tagParser.isFlaky()) .setMuted(tagParser.isMuted()) .setKnown(tagParser.isKnown()); lifecycle.updateTestCase(scenario.getId(), scenarioResult -> scenarioResult.setStatus(Status.SKIPPED) .setStatusDetails(statusDetails)); } } lifecycle.startStep(scenario.getId(), uuid, stepResult); lifecycle.stopStep(uuid); } }