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


Java CucumberFeature类代码示例

本文整理汇总了Java中cucumber.runtime.model.CucumberFeature的典型用法代码示例。如果您正苦于以下问题:Java CucumberFeature类的具体用法?Java CucumberFeature怎么用?Java CucumberFeature使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CucumberFeature类属于cucumber.runtime.model包,在下文中一共展示了CucumberFeature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: filterOnTags

import cucumber.runtime.model.CucumberFeature; //导入依赖的package包/类
private static void filterOnTags(CucumberFeature feature) throws TagFilterException {
    final List<CucumberTagStatement> featureElements = feature.getFeatureElements();
    ServiceLoader<TagFilter> loader = ServiceLoader.load(TagFilter.class);
    for (Iterator<CucumberTagStatement> iterator = featureElements.iterator(); iterator.hasNext();) {
        CucumberTagStatement cucumberTagStatement = iterator.next();
        for (TagFilter implClass : loader) {
            logger.info("Tag filter found: {}", implClass.getClass().getSimpleName());
            final boolean isFiltered = implClass.filter(feature, cucumberTagStatement);
            if (isFiltered) {
                logger.info("skipping feature element {} of feature {} due to feature-tag-filter {} ",
                        cucumberTagStatement.getVisualName(),
                        feature.getPath(), implClass.getClass().getSimpleName());
                iterator.remove();
                break;
            }
        }
    }
}
 
开发者ID:intuit,项目名称:karate,代码行数:19,代码来源:CucumberRunner.java

示例2: Courgette

import cucumber.runtime.model.CucumberFeature; //导入依赖的package包/类
public Courgette(Class clazz) throws IOException, InitializationError {
    super(clazz);
    classLoader = clazz.getClassLoader();

    final CourgetteOptions courgetteOptions = getCourgetteOptions(clazz);
    courgetteProperties = new CourgetteProperties(courgetteOptions, createSessionId(), courgetteOptions.threads());

    final CourgetteFeatureLoader courgetteFeatureLoader = new CourgetteFeatureLoader(courgetteProperties);
    cucumberFeatures = courgetteFeatureLoader.getCucumberFeatures();

    runtimeOptions = courgetteFeatureLoader.getCucumberRuntimeOptions();

    runnerInfoList = new ArrayList<>();

    if (courgetteOptions.runLevel().equals(CourgetteRunLevel.FEATURE)) {
        cucumberFeatures.forEach(feature -> runnerInfoList.add(new CourgetteRunnerInfo(courgetteProperties, feature, null)));
    } else {
        final Map<CucumberFeature, Integer> scenarios = courgetteFeatureLoader.getCucumberScenarios();
        scenarios
                .keySet()
                .forEach(scenario -> runnerInfoList.add(new CourgetteRunnerInfo(courgetteProperties, scenario, scenarios.get(scenario))));
    }
}
 
开发者ID:prashant-ramcharan,项目名称:courgette-jvm,代码行数:24,代码来源:Courgette.java

示例3: addChildren

import cucumber.runtime.model.CucumberFeature; //导入依赖的package包/类
private void addChildren(final List<CucumberFeature> cucumberFeatures,
        final String arg) throws InitializationError {
    for (final CucumberFeature cucumberFeature : cucumberFeatures) {
        children.add(new FeatureRunner(cucumberFeature, runtime,
                jUnitReporter) {
            @Override
            public String getName() {
                return "[" + arg + "] " + super.getName();
            }

            @Override
            public void run(RunNotifier notifier) {
                System.setProperty(SYSTEM_PROPERTY, arg);
                super.run(notifier);
            }
        });
    }
}
 
开发者ID:fuinorg,项目名称:event-store-commons,代码行数:19,代码来源:EscCucumber.java

示例4: CucumberLoadRunner

import cucumber.runtime.model.CucumberFeature; //导入依赖的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 CucumberLoadRunner(Class clazz) throws InitializationError, IOException {
    super(clazz);

    System.setProperty(cukesProperty(CONTEXT_INFLATING_ENABLED), "false");
    System.setProperty(cukesProperty(ASSERTIONS_DISABLED), "true");
    System.setProperty(cukesProperty(LOADRUNNER_FILTER_BLOCKS_REQUESTS), "true");

    filter = SingletonObjectFactory.instance().getInstance(LoadRunnerFilter.class);

    ClassLoader classLoader = clazz.getClassLoader();
    Assertions.assertNoCucumberAnnotatedMethods(clazz);

    RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(clazz);
    RuntimeOptions runtimeOptions = runtimeOptionsFactory.create();

    ResourceLoader resourceLoader = new MultiLoader(classLoader);
    runtime = createRuntime(resourceLoader, classLoader, runtimeOptions);

    final List<CucumberFeature> cucumberFeatures = runtimeOptions.cucumberFeatures(resourceLoader);
    jUnitReporter = new JUnitReporter(runtimeOptions.reporter(classLoader),
        runtimeOptions.formatter(classLoader), runtimeOptions.isStrict(), new JUnitOptions(runtimeOptions.getJunitOptions()));
    addChildren(cucumberFeatures);
}
 
开发者ID:ctco,项目名称:cukes,代码行数:31,代码来源:CucumberLoadRunner.java

示例5: formatterCalledCorrectlyForAFeatureWithOneScenario

import cucumber.runtime.model.CucumberFeature; //导入依赖的package包/类
@Test
public void formatterCalledCorrectlyForAFeatureWithOneScenario() {
	String featurePath = "com/bishnet/cucumber/parallel/runtime/samplefeatures/individual/ValidFeature.feature";
	List<String> arguments = new ArrayList<String>();
	arguments.add("classpath:" + featurePath);
	FeatureParser featureParser = new FeatureParser(getRuntimeConfiguration(arguments), Thread.currentThread()
			.getContextClassLoader());
	for (CucumberFeature cucumberFeature : featureParser.parseFeatures())
		rerunFileBuilder.addFeature(cucumberFeature);
	assertThat(fakeRerunFormatter.getUri()).isEqualTo(featurePath);
	assertThat(fakeRerunFormatter.getStartOfLifeCycleInvocationCount()).isEqualTo(1);
	assertThat(fakeRerunFormatter.getEndOfLifeCycleInvocationCount()).isEqualTo(1);
	assertThat(fakeRerunFormatter.getUriInvocationCount()).isEqualTo(1);
	assertThat(fakeRerunFormatter.getScenarioInvocationCount()).isEqualTo(1);
	assertThat(fakeRerunFormatter.getResult().getStatus()).isEqualTo(Result.FAILED);
}
 
开发者ID:djb61,项目名称:parallel-cucumber-jvm,代码行数:17,代码来源:RerunFileBuilderTest.java

示例6: createRestResultList

import cucumber.runtime.model.CucumberFeature; //导入依赖的package包/类
private void createRestResultList(List<String> results) {
   Map<String, CucumberFeature> scenarios = createMapOfScenarios();
   restScenarioList = new ArrayList<RestScenarioResult>();

   for (Map.Entry<String, CucumberFeature> entry : scenarios.entrySet()) {
      RestScenarioResult restScenarioResult =
         createRestResultForScenario(entry.getKey(), results);
      restScenarioList.add(restScenarioResult);
      CucumberFeature cucumberFeature = entry.getValue();
      String issueKey = getTestIdsFromCucumberFeature(cucumberFeature);
      int index = checkIfContainerAlreadyExistsForTestId(issueKey);
      if (index == -1) {
         createNewContainer(cucumberFeature, restScenarioResult);
      } else {
         addToExistingContainer(index, restScenarioResult);
      }
   }
}
 
开发者ID:LiamHayes1,项目名称:rest-cucumber,代码行数:19,代码来源:Summariser.java

示例7: RestCucumber

import cucumber.runtime.model.CucumberFeature; //导入依赖的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
 * @throws CucumberInitException if the rest client fails to load
 */
public RestCucumber(Class<?> clazz) throws InitializationError, IOException {
   super(clazz);
   ClassLoader classLoader = clazz.getClassLoader();
   Assertions.assertNoCucumberAnnotatedMethods(clazz);
   RestRuntimeOptionsFactory runtimeOptionsFactory =
      new RestRuntimeOptionsFactory(clazz);
   RestRuntimeOptions runtimeOptions = runtimeOptionsFactory.create();
   RestMultiLoader resourceLoader = new RestMultiLoader(classLoader);
   createRestClient(clazz);
   if (restClient != null) {
      resourceLoader.setRestClient(restClient);
   }
   runtime =
      createRuntime(resourceLoader, classLoader, runtimeOptions.getRuntimeOptions());
   List<CucumberFeature> cucumberFeatures =
      runtimeOptions.cucumberFeatures(resourceLoader);
   jUnitReporter =
      new RestJUnitReporter(runtimeOptions.reporter(classLoader),
         runtimeOptions.formatter(classLoader), runtimeOptions.isStrict(), runtime);
   addChildren(cucumberFeatures);
}
 
开发者ID:LiamHayes1,项目名称:rest-cucumber,代码行数:29,代码来源:RestCucumber.java

示例8: givenValidIssueSet_whenLoadingFromJira_thenListOfCucumberFeaturesIsCreated

import cucumber.runtime.model.CucumberFeature; //导入依赖的package包/类
@Test
public void
   givenValidIssueSet_whenLoadingFromJira_thenListOfCucumberFeaturesIsCreated()
      throws IOException {
   List<String> featurePaths = new ArrayList<String>();
   featurePaths.add(RestCucumberFeatureLoader.REST_CLIENT_KEY);
   RestResourceLoader resourceLoader = mock(RestResourceLoader.class);

   RestMultiLoader multiLoader = mock(RestMultiLoader.class);
   given(multiLoader.resources("", RestCucumberFeatureLoader.REST_CLIENT_KEY))
      .willReturn(resourceLoader);
   RestResource jr = mock(RestResource.class);
   RestResourceIterator jit = mock(RestResourceIterator.class);
   given(resourceLoader.iterator()).willReturn(jit);
   given(jit.hasNext()).willReturn(true).willReturn(false);
   given(jit.next()).willReturn(jr);
   given(jr.getInputStream()).willReturn(
      new ByteArrayInputStream(feature.getBytes(StandardCharsets.UTF_8)));
   given(jr.getPath()).willReturn("thisIsAPath");

   List<CucumberFeature> cucumberFeatures =
      RestCucumberFeatureLoader.load(multiLoader, featurePaths,
         new ArrayList<Object>(), System.out);
   assertTrue("Cucumber Feature should not be null from Jira Resource",
      cucumberFeatures != null);
}
 
开发者ID:LiamHayes1,项目名称:rest-cucumber,代码行数:27,代码来源:RestCucumberFeatureLoaderTest.java

示例9: ThreadPoolFeatureRunnerScheduler

import cucumber.runtime.model.CucumberFeature; //导入依赖的package包/类
public ThreadPoolFeatureRunnerScheduler(TestEnvironment environment, 
		CucumberFeature cucumberFeature,
		Runtime runtime, 
		JUnitReporter jUnitReporter,
		int featureFileTimout) throws InitializationError {
	super(cucumberFeature, runtime, jUnitReporter);
	this.environment = environment;
	this.cucumberFeature = cucumberFeature;
	this.jUnitReporter = jUnitReporter;
	this.featureFileTimout = featureFileTimout;
	
	Integer defaultNumThreads = SenBotContext.getSenBotContext().getCucumberManager().getParallelFeatureThreads();
	String threads = System.getProperty("junit.parallel.threads", defaultNumThreads.toString());
	int numThreads = Integer.parseInt(threads);
	executor = Executors.newFixedThreadPool(numThreads);
}
 
开发者ID:gfk-ba,项目名称:senbot,代码行数:17,代码来源:ParameterizedCucumber.java

示例10: testLoadGlue

import cucumber.runtime.model.CucumberFeature; //导入依赖的package包/类
public void testLoadGlue() throws Throwable {
    RemoteBackend remoteBackend = new RemoteBackend(REST_BASE_URL, restTemplate);
    final CucumberFeature feature = TestHelper.feature("nice.feature", join(
            "Feature: Be nice",
            "",
            "Scenario: Say hello to Cucumber",
            "When I say hello to Cucumber",
            "And I say hello to:",
            "| name | gender |",
            "| John | MALE   |",
            "| Mary | FEMALE |"));

    RuntimeOptions runtimeOptions = new RuntimeOptions(Arrays.asList(
            "--glue", "cucumber.runtime.remote.stepdefs",
            "--plugin", "pretty",
            "--monochrome"
            )) {
        @Override
        public List<CucumberFeature> cucumberFeatures(ResourceLoader resourceLoader) {
            return Collections.singletonList(feature);
        }
    };

    Runtime runtime = new Runtime(resourceLoader, classLoader, Collections.singletonList(remoteBackend), runtimeOptions);
    runtime.run();
}
 
开发者ID:viltgroup,项目名称:minium,代码行数:27,代码来源:RemoteBackendTest.java

示例11: setFeatures

import cucumber.runtime.model.CucumberFeature; //导入依赖的package包/类
public static void setFeatures(List<CucumberFeature> cucumberFeatures) {
    int numberOfScenarios = 0;
    for (CucumberFeature feature : cucumberFeatures) {
        for (CucumberTagStatement scenario : feature.getFeatureElements()) {
            if (scenario instanceof CucumberScenario) {
                numberOfScenarios++;
            } else if (scenario instanceof CucumberScenarioOutline) {
                for (CucumberExamples examples : ((CucumberScenarioOutline) scenario).getCucumberExamplesList()) {
                    numberOfScenarios += examples.getExamples().getRows().size() - 1;
                }
            }
        }
    }
    ExecutionProgress currentContextProgress = getCurrent().getProgress();
    currentContextProgress.setNumberOfFeatures(cucumberFeatures.size());
    currentContextProgress.setNumberOfScenarios(numberOfScenarios);
}
 
开发者ID:viltgroup,项目名称:minium,代码行数:18,代码来源:CucumberContext.java

示例12: testLoadDataInExample

import cucumber.runtime.model.CucumberFeature; //导入依赖的package包/类
@Test
public void testLoadDataInExample() throws IOException {
    List<CucumberFeature> cucumberFeatures = Lists.newArrayList();
    StringWriter writer = new StringWriter();
    final PrettyFormatter formatter = new PrettyFormatter(writer, true, false);

    try (MiniumFeatureBuilder builder = new MiniumFeatureBuilder(cucumberFeatures, formatter, null)) {
        Resource resource = createResourceMock("foo-feature-with-comment.feature");
        builder.parse(resource, Collections.emptyList());
        Assert.assertThat(writer.toString().replaceAll("\\s+", " "), Matchers.equalTo(
                Joiner.on("\n").join("Feature: Test 1",
                        "",
                        "  Scenario Outline: Hello world",
                        "    Given <foo> exists",
                        "    Then <bar> should occur",
                        "",
                        "    Examples: ",
                        "      #@source :data-foo.csv",
                        "     | foo2     | bar2      |",
                        "      # data-foo.csv:2",
                        "     | valChanged1 | valChanged2 |",
                        "      # data-foo.csv:3",
                        "     | valChanged3 | valChanged4 |",
                        "").replaceAll("\\s+", " ")));
    }
}
 
开发者ID:viltgroup,项目名称:minium,代码行数:27,代码来源:FeatureDecoratorTest.java

示例13: testLinesOffSetslWithExamples

import cucumber.runtime.model.CucumberFeature; //导入依赖的package包/类
@Test
public void testLinesOffSetslWithExamples() throws IOException {
    Map<Integer, Integer> lineOffsetExpected = Maps.newTreeMap();
    lineOffsetExpected.put(21, 22);
    lineOffsetExpected.put(22, 24);
    lineOffsetExpected.put(23, 26);
    lineOffsetExpected.put(24, 28);
    lineOffsetExpected.put(25, 36);
    lineOffsetExpected.put(26, 37);
    lineOffsetExpected.put(27, 38);
    lineOffsetExpected.put(32, 47);
    lineOffsetExpected.put(33, 48);
    lineOffsetExpected.put(34, 49);
    List<CucumberFeature> features = new ArrayList<CucumberFeature>();
    Map<Integer, Integer> lineOffset;
    try (MiniumFeatureBuilder builder = new MiniumFeatureBuilder(features, true)) {
        Resource resource = createResourceMock("example-with-comments.feature");
        builder.parse(resource, NO_FILTERS);
        lineOffset = builder.getLineOffset();
    }
    assertTrue(lineOffsetExpected.equals(lineOffset));
}
 
开发者ID:viltgroup,项目名称:minium,代码行数:23,代码来源:FeatureLineOffsetsTest.java

示例14: testLinesOffSetsWithDataTables

import cucumber.runtime.model.CucumberFeature; //导入依赖的package包/类
@Test
public void testLinesOffSetsWithDataTables() throws IOException {
    Map<Integer, Integer> lineOffsetExpected = Maps.newTreeMap();
    lineOffsetExpected.put(14, 16);
    lineOffsetExpected.put(15, 17);
    lineOffsetExpected.put(16, 18);
    lineOffsetExpected.put(22, 24);
    lineOffsetExpected.put(23, 25);
    lineOffsetExpected.put(24, 26);
    lineOffsetExpected.put(28, 30);
    lineOffsetExpected.put(29, 31);
    lineOffsetExpected.put(30, 32);
    List<CucumberFeature> features = new ArrayList<CucumberFeature>();
    Map<Integer, Integer> lineOffset;
    try (MiniumFeatureBuilder builder = new MiniumFeatureBuilder(features, true)) {
        Resource resource = createResourceMock("feature-to-test-offsets.feature");
        builder.parse(resource, NO_FILTERS);
        lineOffset = builder.getLineOffset();
    }

    assertTrue(lineOffsetExpected.equals(lineOffset));
}
 
开发者ID:viltgroup,项目名称:minium,代码行数:23,代码来源:FeatureLineOffsetsTest.java

示例15: loadFeatures

import cucumber.runtime.model.CucumberFeature; //导入依赖的package包/类
public static List<KarateFeature> loadFeatures(KarateRuntimeOptions runtimeOptions) {
    List<CucumberFeature> features = runtimeOptions.loadFeatures();
    List<KarateFeature> karateFeatures = new ArrayList(features.size());
    for (CucumberFeature feature : features) {
        KarateFeature kf = new KarateFeature(feature, runtimeOptions);
        karateFeatures.add(kf);
    }
    return karateFeatures;
}
 
开发者ID:intuit,项目名称:karate,代码行数:10,代码来源:KarateFeature.java


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