當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。