当前位置: 首页>>代码示例>>Java>>正文


Java CucumberOptions类代码示例

本文整理汇总了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;
}
 
开发者ID:NoraUi,项目名称:NoraUi,代码行数:27,代码来源:Step.java

示例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;
}
 
开发者ID:prashant-ramcharan,项目名称:courgette-jvm,代码行数:19,代码来源:CourgetteRuntimeOptions.java

示例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));
}
 
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:25,代码来源:CucumberExt.java

示例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;
}
 
开发者ID:Cognifide,项目名称:bobcat,代码行数:11,代码来源:TestObjectTypeListener.java


注:本文中的cucumber.api.CucumberOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。