public RuntimeOptions create() { List<String> args = buildArgsFromOptions(); return new RuntimeOptions(args); }
private Result.Type executeStep(Scenario scenario, boolean skipSteps) throws Throwable { if (!skipSteps) { stepDefinitionMatch.runStep(scenario); return Result.Type.PASSED; } else { stepDefinitionMatch.dryRunStep(scenario); return Result.Type.SKIPPED; } }
private void buildBackendWorlds() { for (Backend backend : backends) { backend.buildWorld(); } }
private CucumberException registerTypeInConfiguration(Exception e) { return new CucumberException(String.format("" + "Could not convert arguments for step [%s] defined at '%s'.\n" + "It appears you did not register a data table type. The details are in the stacktrace below.", //TODO: Add doc URL stepDefinition.getPattern(), stepDefinition.getLocation(true) ), e); }
public void addPluginName(String name, boolean isAddPlugin) { if (PluginFactory.isStepDefinitionReporterName(name)) { stepDefinitionReporterNames.addName(name, isAddPlugin); } else if (PluginFactory.isSummaryPrinterName(name)) { summaryPrinterNames.addName(name, isAddPlugin); } else if (PluginFactory.isFormatterName(name)) { formatterNames.addName(name, isAddPlugin); } else { throw new CucumberException("Unrecognized plugin: " + name); } }
@Override public Collection<? extends Backend> get() { Collection<? extends Backend> backends = loadBackends(); if (backends.isEmpty()) { throw new CucumberException("No backends were found. Please make sure you have a backend module on your CLASSPATH."); } return backends; }
public Builder withArg(final String arg) { this.runtimeOptions = new RuntimeOptions(arg); return this; }
public <T> Collection<? extends T> instantiateSubclasses(Class<T> parentType, List<String> packageNames, Class[] constructorParams, Object[] constructorArgs) { Collection<T> result = new HashSet<T>(); for (String packageName : packageNames) { for (Class<? extends T> clazz : classFinder.getDescendants(parentType, packageName)) { if (Utils.isInstantiable(clazz)) { result.add(newInstance(constructorParams, constructorArgs, clazz)); } } } return result; }
public String get(String key, String defaultValue) { String result = get(key); return result != null ? result : defaultValue; } }
@Override public void execute(final Object[] args) throws Throwable { Utils.invoke(body, method, timeoutMillis, args); }
private void disposeBackendWorlds() { for (Backend backend : backends) { backend.disposeWorld(); } } }
@Override public void runStep(Scenario scenario) throws Throwable { hookDefinition.execute(scenario); }
@Override public void addStepDefinition(StepDefinition stepDefinition) { StepDefinition previous = stepDefinitionsByPattern.get(stepDefinition.getPattern()); if (previous != null) { throw new DuplicateStepDefinitionException(previous, stepDefinition); } stepDefinitionsByPattern.put(stepDefinition.getPattern(), stepDefinition); }
public PickleStepDefinitionMatch(List<Argument> arguments, StepDefinition stepDefinition, String featurePath, PickleStep step) { super(arguments, stepDefinition.getLocation(false)); this.stepDefinition = stepDefinition; this.featurePath = featurePath; this.step = step; }
/** * Create a new instance from a string of options, for example: * <p/> * <pre<{@code "--name 'the fox' --plugin pretty --strict"}</pre> * * @param argv the arguments */ public RuntimeOptions(String argv) { this(Shellwords.parse(argv)); }
@Override public void receive(SnippetsSuggestedEvent event) { handleSnippetsSuggested(event.uri, event.stepLocations, event.snippets); } };
@Override public String getCodeLocation() { return stepDefinitionMatch.getCodeLocation(); }
private CucumberException withLocation(CucumberException exception) { exception.setStackTrace(new StackTraceElement[]{this.location}); return exception; }
private CucumberException couldNotConvertArguments(Exception e) { return new CucumberException(String.format( "Could not convert arguments for step [%s] defined at '%s'.\n" + "The details are in the stacktrace below.", stepDefinition.getPattern(), stepDefinition.getLocation(true) ), e); }
@Override public String getCodeLocation() { return stepDefinition.getLocation(false); }