Contributions
Re: How to execute Cucumber test cases parallel
Consider using TestNGs or JUnits build in parallelism support instead of using surefire to execute your classes in parallel. - https://github.com/cucumber/cucumber-jvm/tree/main/testng#parallel-execution - https://github.com/cucumber/cucumber-jvm/tree/main/junit#parallel-execution-with-maven - https://github.com/cucumber/cucumber-jvm/tree/main/junit-platform-engine#configuration-options4 years agoPlace Cucumber OpenCucumber Open2.1KViews0likes0CommentsRe: How to test multiple conditions in the 'Then' step of a CucumberBDD test?
tookythey're looking for an equivalent to JUnit 4s Error Collector. https://junit.org/junit4/javadoc/4.12/org/junit/rules/ErrorCollector.html This is not supported by by Cucumber but you can emulate it by storing all failed assertions somewhere and throwing them all in an after hook. This issue came up before in the past: https://github.com/cucumber/cucumber-jvm/issues/7714 years agoPlace Cucumber OpenCucumber Open6.2KViews0likes0CommentsRe: Hook after and before group of tagged scenarios
Cucumber currently doesn't support this. You may however be able to replicate this by using a conditional before hook and JUnits after all hook. In the conditional before hook, if the environment hasn't been created, you create it. In the after all hook, you clean up all created environments.You can keep a reference to all created environments in a static variable.4 years agoPlace Cucumber OpenCucumber Open2.2KViews0likes0CommentsRe: What are the new features that will get Updated cucumber from info cukes 1.2.5 to io.cucumber 4.7.2
Check out the changelog and release notes: * https://github.com/cucumber/cucumber-jvm/blob/master/CHANGELOG.md * https://github.com/cucumber/cucumber-jvm/tree/master/release-notes4 years agoPlace Cucumber OpenCucumber Open3.6KViews0likes1CommentRe: can we add doc_string from step definition(.java) instead of feature file?
I got the impression this wasn't a feature request but rather a "How do I do x" disguised as one. To attach data package io.cucumber.examples.java; import io.cucumber.java.Before; import io.cucumber.java.Scenario; import io.cucumber.java.en.Given; public class RpnCalculatorSteps { private Scenario scenario; @Before public void after(Scenario scenario) { this.scenario = scenario; } @Given("I log some data") public void log_some_data(){ scenario.attach("{hello:\"World\"}", "application/json", "hell-world.json"); } } This then shows up in the report as: Given I log some data {hello:"World"}4 years agoPlace Cucumber OpenCucumber Open2KViews0likes1CommentCucumber-JVM v6.0.0 has been released
Cucumber-JVM v6.0.0 has been released. Read the release notes.4 years agoPlace Cucumber OpenCucumber Open1.6KViews0likes0CommentsRe: How to share the Spring Boot context between steps in cucumber test?
If you are using the latest Cucumber (v5.7.0) to make Cucumber aware of your test configuration you can annotate a configuration class on your glue path with `@CucumberContextConfiguration` and with one of the following annotations: `@ContextConfiguration`, `@ContextHierarchy` or `@BootstrapWith`. If you are using SpringBoot, you can annotate configuration class with `@SpringBootTest` For example: import com.example.app; import org.springframework.boot.test.context.SpringBootTest; import io.cucumber.spring.CucumberContextConfiguration; @CucumberContextConfiguration @SpringBootTest(classes = TestConfig.class) public class CucumberSpringConfiguration { } You can then `@Autowire` components from the application context into any step definition file. No further spring configuration is needed. For example: package com.example.app; public class MyStepDefinitions { @Autowired private MyService myService; @Given("feed back is requested from my service") public void feed_back_is_requested(){ myService.requestFeedBack(); } } The only requirement is that both `MyStepDefinitions` and `CucumberSpringConfiguration` are both in a package that is on the glue path. So either you have configured `@CucumberOptions(glue="com.example")` explicitly or your test runner class is in the same package as your step definition (`com.example`). You can find more information in the `cucumber-spring` module in github. https://github.com/cucumber/cucumber-jvm/tree/master/spring4 years agoPlace Cucumber OpenCucumber Open11KViews2likes1Comment