cucumber-jvm

Maven + Cucumber-jvm - How to run different subset of the features depending on environment

偶尔善良 提交于 2019-12-13 12:29:00
问题 I am strugging to achieve this: I want to configure a maven project so that it runs different subsets of the cucumber features depending on the selected profile (dev | pro) For instance, I have a couple of feature files to test web navigation, using tags to specify the environment: PRO @pro Feature: Nav Pro Scenario: navigate to home Given access / Then it should be at the home page DEV @dev Feature: Nav Dev Scenario: navigate to login and log user correctly Given access /login When the user

What is the best way to pass information from one steps def class to another?

ぐ巨炮叔叔 提交于 2019-12-13 07:42:12
问题 Injecting one Steps def into another can rapidly lead to dependency bloat as the amount of re-use among steps defs grows. Furthermore it couples steps defs very tightly to each-other. There must be a better way. Any suggestions? Is passing information between steps defs an anti-pattern that should be avoided anyway? 回答1: If your question is about sharing state between different Step Definition classes, you can do this with Dependency Injection frameworks like Spring. Here's a blog that

How to translate Maven cucumber-jvm junit @CucumberOptions(..) to Eclipse Run Configuration

家住魔仙堡 提交于 2019-12-13 05:38:09
问题 My RunCukeTest class looks like: package runsupport; import .... @RunWith(Cucumber.class) @CucumberOptions( monochrome = true, features = "classpath:features", plugin = {"pretty", "html:target/cucumber-html-report", "json:target/cucumber.json"}, glue = { "classpath:steps", "classpath:runsupport" }, tags = {"@search"} ) public class RunCukesTest{ } How do I convert this to mvn test -Dcucumber.options="" format so that I can run it from the Goals line of a Maven Build run configuration? I want

Gradle for Android: Why doesn't javaexec pick up my classpath?

南笙酒味 提交于 2019-12-13 05:14:45
问题 I have an Android project (on Windows) where I am trying to run cucumber-jvm as a non-instrumented "unit test". I.e. execute Cucumber features when I run gradlew test . Here are the relevant bits of my app's build.gradle : android { ... testOptions { unitTests.all { javaexec { main = "cucumber.api.cli.Main" classpath = getClasspath() args = ['--plugin', 'pretty', '--glue', 'gradle.cucumber', 'src/test/java/cucumber/assets'] } } } } dependencies { implementation fileTree(include: ['*.jar'],

How can i write a customized TestNGCucumberRunner with the latest io.cucumber.cucumber-testng version 4.2.6

我与影子孤独终老i 提交于 2019-12-13 04:36:08
问题 I am trying to write a custom TestNGCucumberRunner (for the latest version cucumber 4.2.6) where I can filter the list of cucumberfeatures based on runtime arguments, in the getFeatures() method. All the examples online are explained with info.cukes 1.2.5 version, where all the dependent classes and methods were public I have never written a testrunner before. Can any one help please? 回答1: First - Update POM.xml with correct set of io.cucumber dependencies as per v 4.2.6 <dependency> <groupId

how to solve NoClassDefFoundError in cucumber test

强颜欢笑 提交于 2019-12-13 00:41:34
问题 i am using eclipse as a IDE and Selenium web driver. i am trying to run test in cucumber-JVM. when i am run test it show me "NoClassDefFoundError ". can anyone help me to solve my problem. all relevant jar files are build in to project file. 回答1: Add cucumber-jvm-deps-1.0.3.jar file into your build path. You can download cucumber-jvm-deps-1.0.3.jar file from cucumber-jvm-deps-1.0.3 回答2: If the NoClassDefFoundError is coming from either XmlPullParser or dom4j/element u need to install this

Cucumber-JVM 3 - Convert DataTable to single object using asMap()

岁酱吖の 提交于 2019-12-12 14:02:38
问题 In cucumber-jvm 3.x.x , I want to convert a datatable with only 2 columns to a single object. This used to be automatic in 2.x.x but has since been removed with the new major version. Code: // Feature Scenario: Scan Barcode Given I Am At The Login Page When I Log In As Valid User | group | gpao | | username | svgpao1 | | password | REDACTED | // Stepdef @When("I Log In As Valid User") public void I_Log_In_As_Valid_User(User user) throws Throwable { Selenium.enterText(driver, user.getUsername(

How to implement different data for cucumber scenarios based on environment

江枫思渺然 提交于 2019-12-12 12:52:24
问题 I have an issue with executing the cucumber-jvm scenarios in different environments. Data that is incorporated in the feature files for scenarios belongs to one environment. To execute the scenarios in different environemnts, I need to update the data in the features files as per the environment to be executed. for example, in the following scenario, i have the search criteria included in the feature file. search criteria is valid for lets say QA env. Scenario: search user with valid criteria

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

Global BeforeAll Hook for cucumber-jvm?

天涯浪子 提交于 2019-12-12 10:44:08
问题 The ruby version of cucumber supports a global before hook. An *.rb file placed in the features/support directory gets apparently called only once, before any and all scenarios run. See https://github.com/cucumber/cucumber/wiki/Hooks#global-hooks That seems to be a great way to make sure a database (used in read-only during tests) gets populated (and thus is in a known state) before any tests run. Is there a similar feature available for the Java version of cucumber? 回答1: Please follow this