本文整理汇总了Java中cucumber.api.CucumberOptions类的典型用法代码示例。如果您正苦于以下问题:Java CucumberOptions类的具体用法?Java CucumberOptions怎么用?Java CucumberOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CucumberOptions类属于cucumber.api包,在下文中一共展示了CucumberOptions类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllCucumberMethods
import cucumber.api.CucumberOptions; //导入依赖的package包/类
/**
* 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) {
Map<String, Method> result = new HashMap<>();
CucumberOptions co = clazz.getAnnotation(CucumberOptions.class);
Set<Class<?>> classes = getClasses(co.glue());
classes.add(BrowserSteps.class);
for (Class<?> c : classes) {
Method[] methods = c.getDeclaredMethods();
for (Method method : methods) {
for (Annotation stepAnnotation : method.getAnnotations()) {
if (stepAnnotation.annotationType().isAnnotationPresent(StepDefAnnotation.class)) {
result.put(stepAnnotation.toString(), method);
}
}
}
}
return result;
}
示例2: createRuntimeOptions
import cucumber.api.CucumberOptions; //导入依赖的package包/类
private Map<String, List<String>> createRuntimeOptions(CucumberOptions cucumberOptions, String path) {
final Map<String, List<String>> runtimeOptions = new HashMap<>();
runtimeOptions.put("--glue", optionParser.apply("--glue", envCucumberOptionParser.apply("glue", cucumberOptions.glue())));
runtimeOptions.put("--tags", optionParser.apply("--tags", envCucumberOptionParser.apply("tags", cucumberOptions.tags())));
runtimeOptions.put("--plugin", optionParser.apply("--plugin", parsePlugins(envCucumberOptionParser.apply("plugin", cucumberOptions.plugin()))));
runtimeOptions.put("--format", optionParser.apply("--format", parsePlugins(envCucumberOptionParser.apply("format", cucumberOptions.format()))));
runtimeOptions.put("--name", optionParser.apply("--name", envCucumberOptionParser.apply("name", cucumberOptions.name())));
runtimeOptions.put("--junit", optionParser.apply("--junit", envCucumberOptionParser.apply("junit", cucumberOptions.junit())));
runtimeOptions.put("--snippets", optionParser.apply("--snippets", cucumberOptions.snippets()));
runtimeOptions.put("--dryRun", Collections.singletonList(cucumberOptions.dryRun() ? "--dry-run" : "--no-dry-run"));
runtimeOptions.put("--strict", Collections.singletonList(cucumberOptions.strict() ? "--strict" : "--no-strict"));
runtimeOptions.put("--monochrome", Collections.singletonList(cucumberOptions.monochrome() ? "--monochrome" : "--no-monochrome"));
runtimeOptions.put(null, featureParser.apply(cucumberOptions.features(), path == null ? null : path));
runtimeOptions.values().removeIf(Objects::isNull);
return runtimeOptions;
}
示例3: CucumberExt
import cucumber.api.CucumberOptions; //导入依赖的package包/类
/**
* Constructor called by JUnit.
*
* @param clazz the class with the @RunWith annotation.
* @throws java.io.IOException if there is a problem
* @throws org.junit.runners.model.InitializationError
* if there is another problem
*/
public CucumberExt(Class clazz) throws InitializationError, IOException {
super(clazz);
ClassLoader classLoader = clazz.getClassLoader();
Assertions.assertNoCucumberAnnotatedMethods(clazz);
@SuppressWarnings("unchecked")
RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(clazz, new Class[]{CucumberOptions.class, Cucumber.Options.class});
RuntimeOptions runtimeOptions = runtimeOptionsFactory.create();
ResourceLoader resourceLoader = createResourceLoader(clazz);
ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
runtime = new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
jUnitReporter = new JUnitReporter(runtimeOptions.reporter(classLoader), runtimeOptions.formatter(classLoader), runtimeOptions.isStrict());
addChildren(runtimeOptions.cucumberFeatures(resourceLoader));
}
示例4: isApplicable
import cucumber.api.CucumberOptions; //导入依赖的package包/类
private <I> boolean isApplicable(Class<? super I> rawType) {
boolean result;
if (rawType.isAnnotationPresent(RunWith.class)
&& !rawType.isAnnotationPresent(CucumberOptions.class)) {
result = true;
} else {
result = isStepsImplementationClass(rawType);
}
return result;
}