cucumber-junit

How to run scenarios in Cucumber-JVM in parallel? [duplicate]

本秂侑毒 提交于 2019-12-12 12:08:41
问题 This question already has answers here : How to execute cucumber feature file parallel (4 answers) Closed 2 years ago . I have a set of acceptance tests written for the Cucumber-JVM. In order to reduce the feedback time I would like to run the scenarios (of a feature) in parallel. How do I do that in the simplest and most convenient way? (I would prefer to be able to express this in Java code, as a regular JUnit test/runner, i.e. I would prefer not to resort to some workaround using the maven

Pass cucumber options dynamically in cucumber-junit?

我是研究僧i 提交于 2019-12-11 19:57:40
问题 I understand that @CucumberOptions is used to pass Cucumber options. However, due to the limitation that Java annotations only allow inline constants, it is quite cumbersome to use @CucumberOptions . So, is there a dynamic way to pass Cucumber options when using cucumber-junit? Thank you very much. 回答1: This question is quite old now, but the answer is yes you can. If you are using maven for example just add it like this. mvn test -Dcucumber.options="--tags @your_tag" You can filter yous

Creating Cucumber Test on Executable Docker Image

僤鯓⒐⒋嵵緔 提交于 2019-12-11 18:30:16
问题 I am trying to come up with an idea on how to create a Cucumber Test on Docker Executable Image? public class GenerateNumber { public static void main(String[] args) { if (args != null && args.length > 0) { String input = args[0]; if(input.equals("ODD")) { //GENERATE ODD NUMBERS FROM 0 TO 1000 }else { //GENERATE EVEN NUMBERS FROM 0 TO 1000 } } } } Supposed I have this simple class file...I am packaging it into an executable Jar File and use this class as an entry point in my application. The

Unable to create test Runner class in Cucumber Framework due to Error in resolving Cucumber Options

旧时模样 提交于 2019-12-11 17:58:24
问题 I am working on creating a Cucumber Framework for Test Automation. Issue I am facing is I am not able to resolve the imports for CucumberOptions in the Test Runner class Initially I tried to use the Suggestion of importing cucumber.api which is now deprecated. Then I went to the official Cucumber site to find the imports but they are not solving the problem as well. Deprecated Import : import cucumber.api.CucumberOptions; Import from Cucumber Official Site : import io.cucumber.junit.Cucumber;

JUnit Cucumber cannot find steps

会有一股神秘感。 提交于 2019-12-11 12:59:37
问题 During the execution of the "mvn test" command, I obtain this error message : 7 Scenarios (7 undefined) 31 Steps (31 undefined) 0m0,000s You can implement missing steps with the snippets below... Nevertheless all this steps is defined well in my files and correspond well to snippets proposed in the error message ! This is my Cucumber runner : @RunWith(ExtendedCucumber.class) @ExtendedCucumberOptions(jsonReport = "target/cucumber.json", retryCount = 3, detailedReport = true,

Execute @Given only once in cucumber feature file

南笙酒味 提交于 2019-12-11 09:22:46
问题 I have the following feature that I would like to test in cucumber. But, I would like to process the input file only once ( @Given in the below feature ). But, it seems to be executing the @Given step each time. Is it possible to execute this @Given in the following feature only once? @fileValidation Scenario Outline: File Validation Given a file is uploaded with name "something.csv" Then response filename created should not match input filename "something.csv" And reason for errors should be

How to write numbers in cucumber scenarios

允我心安 提交于 2019-12-11 05:47:59
问题 I would like to write a number in cucumber page. Please let me know How can I write this. Scenario Outline: Enter an invalid URL Given the context "Invalid URL" is open on "Market" When user is on the error 404 page Then page not found message is displayed But i have observed that 404 is taken as a parameter. 回答1: Sure, you just have to handle it as a regular expression (regex) in your step definitions. Your step definition could read as following: @When("^When user is on the error \"(\\d+)\"

Gradle doesn't pick up Cucumber-jvm

倾然丶 夕夏残阳落幕 提交于 2019-12-10 18:12:32
问题 I am trying to run Cucumber-jvm from Gradle. However no matter what I do I cannot get the features to actually run. They are always skipped while other JUnit tests are run. My features are in src/test/resources and I have a JUnit test in src/test/java with @RunWith(Cucumber.class) and @Feature(Myfeature.feature) attributes specified. Here is my Gradle script: repositories { mavenCentral() } dependencies { testCompile group: 'junit', name: 'junit', version: '4.+' testCompile group: 'info.cukes

Cucumber with Guice - multiple guice injector

末鹿安然 提交于 2019-12-10 15:56:57
问题 I'm using Cucumber with Guice as DI. I've encountered following problem: I've got one step i.e. class MyStep() { @Inject private MyService myService; @Given("Some acction happen") public void sthHappen() { myService.doSth(); } } And I've got this class to run it as JUnit test @RunWith(Cucumber.class) @CucumberOptions(...) public class MyTest { } There is a class MyModule extends AbstractModule { @Override protected void configure() { bind(MyService.class).to(MyFirstService.class); } } which

Alternate way to run Cucumber without JUnit?

亡梦爱人 提交于 2019-12-10 11:38:22
问题 Is there any alternate way to run the cucumber without Junit. Is that any possible way to run cucumber as a Java application.. like if I create a main() method and control all step definitions over there? Any help will be awesome 回答1: The answer is out of date. The cucumber docs have this to say, "Running Cucumber There are several ways to run scenarios with Cucumber-JVM: JUnit Runner CLI Runner Android Runner Third party runners " 回答2: Cucumber JVM can be invoked from command line. So the