本文整理匯總了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;
}