gherkin.pickles.Pickle Java Examples
The following examples show how to use
gherkin.pickles.Pickle.
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: TCKTestCase.java From openCypher with Apache License 2.0 | 5 votes |
public TCKTestCase(Pickle pickle, List<TestStep> testSteps, String uri, int line) { this.name = pickle.getName(); this.testSteps = testSteps; this.tags = pickle.getTags(); this.uri = uri; this.line = line; }
Example #2
Source File: CucumberReportAdapter.java From openCypher with Apache License 2.0 | 5 votes |
private Consumer<Scenario> scenarioStartedEvent() { return scenario -> { Long startedAt = time(); String featureUri = checkNull(featureNameToUri.get(scenario.featureName())); Pickle pickle = scenario.source(); List<TestStep> steps = pickle.getSteps() .stream() .map(step -> new TCKTestStep(step, featureUri, outlineLocation(step.getLocations()))) .collect(Collectors.toList()); int line = outlineLocation(pickle.getLocations()); currentTestCase = new TCKTestCase(pickle, steps, featureUri, line); bus.handle(new TestCaseStarted(startedAt, currentTestCase)); }; }
Example #3
Source File: AllureCucumber4JvmTest.java From allure-java with Apache License 2.0 | 4 votes |
private static List<PickleEvent> compilePickles(GherkinDocument gherkinDocument, String resource) { if (gherkinDocument.getFeature() == null) { return Collections.emptyList(); } List<PickleEvent> pickleEvents = new ArrayList<>(); for (Pickle pickle : new Compiler().compile(gherkinDocument)) { pickleEvents.add(new PickleEvent(resource, pickle)); } return pickleEvents; }
Example #4
Source File: CucumberITGeneratorByFeature.java From cucumber-jvm-parallel-plugin with Apache License 2.0 | 4 votes |
/** * Generates a single Cucumber runner for each separate feature file. * * @param outputDirectory the output directory to place generated files * @param featureFiles The feature files to create runners for * @throws MojoExecutionException if something goes wrong */ public void generateCucumberITFiles(final File outputDirectory, final Collection<File> featureFiles) throws MojoExecutionException { Parser<GherkinDocument> parser = new Parser<GherkinDocument>(new AstBuilder()); TagPredicate tagPredicate = new TagPredicate(overriddenParameters.getTags()); TokenMatcher matcher = new TokenMatcher(); for (final File file : featureFiles) { GherkinDocument gherkinDocument = null; final List<Pickle> acceptedPickles = new ArrayList<Pickle>(); try { String source = FileUtils.readFileToString(file); gherkinDocument = parser.parse(source, matcher); Compiler compiler = new Compiler(); List<Pickle> pickles = compiler.compile(gherkinDocument); for (Pickle pickle : pickles) { if (tagPredicate.apply(pickle.getTags())) { acceptedPickles.add(pickle); continue; } } } catch (final IOException e) { // should never happen // TODO - proper logging System.out.println(format("WARNING: Failed to parse '%s'...IGNORING", file.getName())); } if (acceptedPickles.isEmpty()) { continue; } outputFileName = classNamingScheme.generate(file.getName()); setFeatureFileLocation(file); setParsedFeature(gherkinDocument.getFeature()); writeFile(outputDirectory); } }
Example #5
Source File: CucumberITGeneratorByScenario.java From cucumber-jvm-parallel-plugin with Apache License 2.0 | 4 votes |
private Location findLocationByIndex(Pickle pickle, int locationIndex) { return new Location(pickle.getLocations().get(locationIndex).getLine(), pickle.getLocations().get(locationIndex).getColumn()); }
Example #6
Source File: TagPredicateTest.java From cucumber-jvm-parallel-plugin with Apache License 2.0 | 4 votes |
private PickleEvent createPickleWithTags(List<PickleTag> tags) { return new PickleEvent("uri", new Pickle(NAME, LANGUAGE, NO_STEPS, tags, asList(MOCK_LOCATION))); }