@Override public void feature(Feature feature) { printComments(feature.getComments(), ""); printTags(feature.getTags(), ""); out.println(feature.getKeyword() + ": " + feature.getName()); printDescription(feature.getDescription(), " ", false); }
@Override public String getName() { Feature feature = cucumberFeature.getGherkinFeature(); return feature.getKeyword() + ": " + feature.getName(); }
public void feature(Feature feature) { out.append(feature.getName()).append("\n\n"); writeNarrative(feature.getDescription()); writeMeta(feature.getTags()); }
private String getName( Feature feature ) { return escape( feature.getName() ); } }
@Override public void feature(Feature feature) { this.feature = feature; uid = UUID.randomUUID().toString(); TestSuiteStartedEvent event = new TestSuiteStartedEvent(uid, feature.getName()); Collection<Annotation> annotations = new ArrayList<>(); annotations.add(getDescriptionAnnotation(feature.getDescription())); annotations.add(getFeaturesAnnotation(feature.getName())); AnnotationManager am = new AnnotationManager(annotations); am.update(event); ALLURE_LIFECYCLE.fire(event); }
protected boolean getStatusDetailByTag(final String tagName) { return scenario.getTags().stream() .anyMatch(tag -> tag.getName().equalsIgnoreCase(tagName)) || feature.getTags().stream() .anyMatch(tag -> tag.getName().equalsIgnoreCase(tagName)); }
@Override public synchronized String getSafeName() { if (safeName != null) { return safeName; } safeName = uniquifyName(parent.getChildren(), safe(feature.getId())); return safeName; }
public Optional<Narrative> loadFeatureNarrative(File narrativeFile) { CucumberFeatureListener gherkinStructure =new CucumberFeatureListener(); Parser parser = new Parser(gherkinStructure, true, "root", false, locale); try { String gherkinScenarios = filterOutCommentsFrom(FileUtils.readFileToString(narrativeFile)); parser.parse(gherkinScenarios, narrativeFile.getName(),0); String cardNumber = findCardNumberInTags(gherkinStructure.getFeature().getTags()); List<String> versionNumbers = findVersionNumberInTags(gherkinStructure.getFeature().getTags()); String title = gherkinStructure.getFeature().getName(); String text = gherkinStructure.getFeature().getDescription(); return Optional.of(new Narrative(Optional.fromNullable(title), Optional.fromNullable(cardNumber), versionNumbers, "feature", text)); } catch (IOException ex) { ex.printStackTrace(); } return Optional.absent(); }
private void writeElement( Document doc, Element tc ) { tc.setAttribute( "classname", feature.getName() ); tc.setAttribute( "name", calculateElementName( scenario ) ); }
public Feature convert(CucumberFeature cucumberFeature) { Feature feature = new Feature(cucumberFeature.getPath(), cucumberFeature.getGherkinFeature().getName()); feature.addTags(convertTags(cucumberFeature.getGherkinFeature().getTags())); for (CucumberTagStatement featureElement : cucumberFeature.getFeatureElements()) { if (featureElement instanceof CucumberScenario) { CucumberScenario scenario = (CucumberScenario) featureElement; feature.add(convertScenario(scenario)); // Workaround... no way to retrieve the background CucumberBackground cucumberBackground = scenario.getCucumberBackground(); if (cucumberBackground != null) feature.background(convertBackground(cucumberBackground)); } else if (featureElement instanceof CucumberScenarioOutline) { CucumberScenarioOutline scenarioOutline = (CucumberScenarioOutline) featureElement; feature.add(convertOutline(scenarioOutline)); } } return feature; }
@Override public String getName() { Feature feature = cucumberFeature.getGherkinFeature(); return feature.getKeyword() + ": " + feature.getName(); }
featuresById.put(fr.getSafeName(), fr); for (ScenarioResult scenarioResult : fr.getChildren()) { for (Tag tag : scenarioResult.getParent().getFeature().getTags()) { TagResult tr = tagMap.get(tag.getName()); if (tr == null) {
protected String getStepUuid(final Step step) { return feature.getId() + scenario.getId() + step.getName() + step.getLine(); }
public void feature(Feature feature) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Feature: " + feature.getKeyword() + feature.getName()); List<Tag> tags = feature.getTags(); for (Tag tag : tags) { LOG.log(Level.FINE, " " + tag.getName()); } LOG.log(Level.FINE, " " + feature.getDescription()); } // a new feature being received signals the end of the previous feature currentFeatureResult = new FeatureResult(currentURI, feature); currentURI = null; testResult.addFeatureResult(currentFeatureResult); }
@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); }
@Exported(visibility=9) public String getName() { return feature.getName(); }
/** * Start Cucumber feature * * @param feature Step feature */ protected void beforeFeature(Feature feature) { StartTestItemRQ rq = new StartTestItemRQ(); Maybe<String> root = getRootItemId(); rq.setDescription(Utils.buildStatementName(feature, null, AbstractReporter.COLON_INFIX, null)); rq.setName(currentFeatureUri); rq.setTags(extractTags(feature.getTags())); rq.setStartTime(Calendar.getInstance().getTime()); rq.setType(getFeatureTestItemType()); if (null == root) { currentFeatureId = RP.get().startTestItem(rq); } else { currentFeatureId = RP.get().startTestItem(root, rq); } }
public FeatureExec convertFeature(String uri, Feature feature) { FeatureExec featureExec = new FeatureExec(uri, feature.getKeyword(), feature.getName()); featureExec.declareTags(convertTags(feature.getTags())); featureExec.declareComments(convertComments(feature.getComments())); featureExec.declareDescription(feature.getDescription()); return featureExec; }
private String extractFeatureName() { return cucumberFeature.getGherkinFeature().getName(); }