use of cucumber.api.CucumberOptions in project cucumber-jvm by cucumber.
the class RuntimeOptionsFactory method buildArgsFromOptions.
private List<String> buildArgsFromOptions() {
List<String> args = new ArrayList<String>();
for (Class classWithOptions = clazz; hasSuperClass(classWithOptions); classWithOptions = classWithOptions.getSuperclass()) {
CucumberOptions options = getOptions(classWithOptions);
if (options != null) {
addDryRun(options, args);
addMonochrome(options, args);
addTags(options, args);
addPlugins(options, args);
addStrict(options, args);
addName(options, args);
addSnippets(options, args);
addGlue(options, args);
addFeatures(options, args);
addJunitOptions(options, args);
}
}
addDefaultFeaturePathIfNoFeaturePathIsSpecified(args, clazz);
addDefaultGlueIfNoGlueIsSpecified(args, clazz);
addNullFormatIfNoPluginIsSpecified(args);
return args;
}
use of cucumber.api.CucumberOptions in project NoraUi by NoraUi.
the class Step method getAllCucumberMethods.
/**
* Gets all Cucumber methods.
*
* @param clazz
* Class which is the main point of the application (Decorated with the annotation {@link cucumber.api.CucumberOptions})
* @return a Map of all Cucumber glue code methods of the application. First part of the entry is the Gherkin matching regular expression.
* Second part is the corresponding invokable method.
*/
public static Map<String, Method> getAllCucumberMethods(Class<?> clazz) {
final Map<String, Method> result = new HashMap<>();
final CucumberOptions co = clazz.getAnnotation(CucumberOptions.class);
final Set<Class<?>> classes = getClasses(co.glue());
classes.add(BrowserSteps.class);
for (final Class<?> c : classes) {
final Method[] methods = c.getDeclaredMethods();
for (final Method method : methods) {
for (final Annotation stepAnnotation : method.getAnnotations()) {
if (stepAnnotation.annotationType().isAnnotationPresent(StepDefAnnotation.class)) {
result.put(stepAnnotation.toString(), method);
}
}
}
}
return result;
}
Aggregations