private List<Description> filterExamples(ArrayList<Description> children) { for (int i = 0; i < children.size(); i++) { Description child = (Description) children.get(i); boolean isExample = child.getDisplayName().startsWith( keywords.examplesTableRow() + " "); if (isExample) { return children.subList(i, children.size()); } } return Collections.emptyList(); }
private void addNonExistingStep(Description description, String stringStepOneLine, String stepAsString) { Keywords keywords = configuration.keywords(); if (keywords.isIgnorableStep(stepAsString)) { if (isStep(keywords.stepWithoutStartingWord(stepAsString, StepType.IGNORABLE))) { addIgnorableStep(description, stringStepOneLine); } } else { addPendingStep(description, stringStepOneLine); } }
private boolean isStep(String stepAsString) { Keywords keywords = configuration.keywords(); for (String stepStartingWord : keywords.startingWordsByType().values()) { if (keywords.stepStartsWithWord(stepAsString, stepStartingWord)) { return true; } } return false; }
private String getNarrativeFrom(Story story) { return (!story.getNarrative().isEmpty()) ? story.getNarrative().asString(new Keywords()).trim() : ""; }
private Description createDescriptionForScenario(Scenario scenario) { return Description.createSuiteDescription(configuration.keywords().scenario() + " " + getJunitSafeString(scenario.getTitle())); } }
private void addNonExistingStep(Description description, String stringStepOneLine, String stringStep) { try { StepType stepType = configuration.keywords() .stepTypeFor(stringStep); if (stepType == StepType.IGNORABLE) { addIgnorableStep(description, stringStepOneLine); } else { addPendingStep(description, stringStepOneLine); } } catch (StartingWordNotFound e) { // WHAT NOW? } }
private String getNarrativeFrom(Story story) { return (!story.getNarrative().isEmpty()) ? story.getNarrative().asString(new Keywords()).trim() : ""; }
private Description createDescriptionForScenario(Scenario scenario) { Description scenarioDescription = Description .createSuiteDescription(configuration.keywords().scenario() + " " + getJunitSafeString(scenario.getTitle())); return scenarioDescription; }
private List<Description> filterExamples(List<Description> children) { for (int i = 0; i < children.size(); i++) { Description child = children.get(i); boolean isExample = child.getDisplayName().startsWith( keywords.examplesTableRow() + " "); if (isExample) { return children.subList(i, children.size()); } } return Collections.emptyList(); }
@Override public void run(RunNotifier notifier) { getConfiguredEmbedder().embedderControls().doIgnoreFailureInView(getIgnoreFailuresInView()); getConfiguredEmbedder().embedderControls().doIgnoreFailureInStories(getIgnoreFailuresInStories()); getConfiguredEmbedder().embedderControls().useStoryTimeoutInSecs(getStoryTimeoutInSecs()); if (metaFiltersAreDefined()) { getConfiguredEmbedder().useMetaFilters(getMetaFilters()); } JUnitScenarioReporter junitReporter = new JUnitScenarioReporter(notifier, testCount(), getDescription(), new Keywords()); // tell the reporter how to handle pending steps junitReporter.usePendingStepStrategy(getConfiguration().pendingStepStrategy()); addToStoryReporterFormats(junitReporter); try { getConfiguredEmbedder().runStoriesAsPaths(getStoryPaths()); } catch (Throwable e) { throw new RuntimeException(e); } finally { if (usingUniqueBrowser()) { ThucydidesWebDriverSupport.closeAllDrivers(); } getConfiguredEmbedder().generateCrossReference(); } shutdownTestSuite(); }
private void insertDescriptionForExamples(Scenario scenario, Description scenarioDescription) { ExamplesTable examplesTable = scenario.getExamplesTable(); List<Map<String, String>> rows = examplesTable.getRows(); for (Map<String, String> row : rows) { Description exampleRowDescription = Description .createSuiteDescription( configuration.keywords().examplesTableRow() + " " + row, (Annotation[]) null); scenarioDescription.addChild(exampleRowDescription); addStepsToExample(scenario, exampleRowDescription); } }
private void insertDescriptionForExamples(Lifecycle lifecycle, PerformableScenario performableScenario, Description scenarioDescription) { Scenario scenario = performableScenario.getScenario(); for (ExamplePerformableScenario examplePerformableScenario : performableScenario.getExamples()) { Description exampleRowDescription = Description.createSuiteDescription( configuration.keywords().examplesTableRow() + " " + examplePerformableScenario.getParameters()); scenarioDescription.addChild(exampleRowDescription); if (hasGivenStories(scenario)) { insertGivenStories(scenario, exampleRowDescription); } addScenarioSteps(lifecycle, ScenarioType.EXAMPLE, scenario, exampleRowDescription); } }