@Override public synchronized String getSafeName() { if (safeName != null) { return safeName; } String name = safe(scenario.getId()); String parentName = parent.getSafeName() + ';'; if (name.startsWith(parentName)) { name = name.replace(parentName, ""); } safeName = uniquifyName(parent.getChildren(), name); return safeName; }
protected String getStepUuid(final Step step) { return feature.getId() + scenario.getId() + step.getName() + step.getLine(); }
@Override public void startOfScenarioLifeCycle(final Scenario scenario) { this.currentScenario = scenario; final Deque<Tag> tags = new LinkedList<>(scenario.getTags()); if (SCENARIO_OUTLINE_KEYWORDS.contains(scenario.getKeyword())) { synchronized (gherkinSteps) { gherkinSteps.clear(); } } else { tags.addAll(currentFeature.getTags()); } final LabelBuilder labelBuilder = new LabelBuilder(currentFeature, scenario, tags); final String uuid = UUID.randomUUID().toString(); scenarioUuids.put(scenario, uuid); final TestResult result = new TestResult() .setUuid(uuid) .setHistoryId(StepUtils.getHistoryId(scenario.getId())) .setFullName(String.format("%s: %s", currentFeature.getName(), scenario.getName())) .setName(scenario.getName()) .setLabels(labelBuilder.getScenarioLabels()) .setLinks(labelBuilder.getScenarioLinks()); if (!currentFeature.getDescription().isEmpty()) { result.setDescription(currentFeature.getDescription()); } lifecycle.scheduleTestCase(result); lifecycle.startTestCase(uuid); }
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); } }
protected void fireCanceledStep(final Step unimplementedStep) { final StepResult stepResult = new StepResult(); stepResult.setName(unimplementedStep.getName()) .setStart(System.currentTimeMillis()) .setStop(System.currentTimeMillis()) .setStatus(Status.SKIPPED) .setStatusDetails(new StatusDetails().setMessage("Unimplemented step")); lifecycle.startStep(scenario.getId(), getStepUuid(unimplementedStep), stepResult); lifecycle.stopStep(getStepUuid(unimplementedStep)); final StatusDetails statusDetails = new StatusDetails(); final TagParser tagParser = new TagParser(feature, scenario); statusDetails .setFlaky(tagParser.isFlaky()) .setMuted(tagParser.isMuted()) .setKnown(tagParser.isKnown()); lifecycle.updateTestCase(scenario.getId(), scenarioResult -> scenarioResult.setStatus(Status.SKIPPED) .setStatusDetails(statusDetails .setMessage("Unimplemented steps were found"))); }