cucumber-jvm

How to make Cucumber features run in an Android project as local unit tests?

家住魔仙堡 提交于 2019-12-24 10:27:28
问题 I have an Android project written in Java that I'm working on in Android Studio. I'd like to use Cucumber for integration testing of some internal components (note: I know this is not the BDD way, nonetheless useful to me). I want the tests to run as local unit tests (without Instrumentation) using gradlew test because the components under test do not interact with the Android SDK. My problem is that the Cucumber features are not recognized by Gradle and do not run when I run gradlew test .

How to have multiple Cucumber step definitions in the same project for testing product variants

二次信任 提交于 2019-12-24 08:25:39
问题 I'm working on an automation project for a mobile app in ios and android. I'm using Java-Appium-Cucumber framework for writing tests. Below shows my project structure src android features step_definitions ios features step_definitions I need a step "User logins to the app" for both android and ios. But the implementation in android and ios are different. So I wrote two step definitions in android > step_definitions and in ios > step_definitions. But this results in duplicate step definition

Integrating external data source with Cucumber feature file

帅比萌擦擦* 提交于 2019-12-23 13:12:06
问题 I am new to Cucumber and the feature files it uses for BDD. I want to know if there is any way I could directly give the filepath of my external data file (eg. CSV file), and fetch the values of the parameters I use to create my test script. 回答1: You can add a tag with parameter to the features @data("/path/data.json") Scenario: Login as zinc admin Given I open zinc homepage And then create hook that reads the param and loads file before running a scenario. Before do |scenario| // read data

Cucumber `--tags` options from command line?

我是研究僧i 提交于 2019-12-23 11:46:10
问题 What i would like to do is to pass cucumber options from command line to execute scenarios with tag name @extecuteThese but also i wanted to exclude scenarios that are with tag name @WIP so what am i doing so far is -Dcucumber.options='--tags @executeThese --tags ~@WIP' But unfortunately, it's not considering ~@WIP tag option Any help, much appreciated!! 回答1: Lets pretend this is your feature: Feature ABC @executeThese Scenario: abc1 @WIP @executeThese Scenario: abc2 What you are currently

How to pass variable & values between cucumber jvm scenarios

喜你入骨 提交于 2019-12-23 05:50:35
问题 I have two scenarios A and B. I am storing the value of a field output of 'A' scenario in a variable. Now i have to use that variable in the Scenario 'B'. How can i pass a variable and its value from one scenario to other in Cucumber Java 回答1: It's not entirely clear if your step definitions for these scenarios are in separate classes, but I assume they are and that the step in ScenarioA is executed before the one in B. public class ScenarioA { public static String getVariableYouWantToUse() {

cucumber.runtime.CucumberException: Failed to instantiate class

最后都变了- 提交于 2019-12-23 04:57:07
问题 Here is my cucumber base class. @CucumberOptions(plugin = "json:target/cucumber-report.json", features="SFDC_Automation/features/featurefilename.feature", glue="classpath:tests.SFDC.StepDef") public class InsideSaleTest extends AbstractTestNGCucumberTests { } And after running this base class, I am seeing following exception. cucumber.runtime.CucumberException: Failed to instantiate class tests.SFDC.InsideSale.InsideSaleEndToEnd ===============================================

Cucumber Report Missing report result - report was not successfully completed

£可爱£侵袭症+ 提交于 2019-12-22 14:03:04
问题 I use Cucumber Reports plugin to get cucumber reports in pipeline jobs it works fine before but now i have this error: [CucumberReport] Preparing Cucumber Reports [CucumberReport] JSON report directory is "target/" [CucumberReport] Copied 1 json files from workspace "c:/jenkins/workspace/..." to reports directory "/var/jenkins_home/jobs/..." [CucumberReport] Copied 0 properties files from workspace "c:/jenkins/workspace/..." to reports directory "/var/jenkins_home/jobs/..." [CucumberReport]

Parallel Test run with cucumber

放肆的年华 提交于 2019-12-22 13:11:18
问题 I am currently trying to achieve parallel test run with cucumber. I managed to run two different runners at the same time with the sure-fire plugin. Now I want to check whether is it possible to run SingleRunner file multiple times in parallel. Ex: I have SignUpRunnerTest.java so I need to run this against few platforms parally.Is it possible? This is my Runner file import cucumber.api.CucumberOptions; import cucumber.api.cli.Main; import cucumber.api.junit.Cucumber; import java.util.List;

@DirtiesContext tears context down after every cucumber test scenario, not class

倖福魔咒の 提交于 2019-12-22 05:58:12
问题 Integration test executed by cucumber tends to leave behind context that causes problems with subsequent tests. Obvious solution appeared to be Spring's @DirtiesContext , but instead of tearing down the context after all the cucumber features have been run, it does this after each and every scenario, thus making the test execution time rather lengthy. Tried also with @TestExecutionListeners , but no luck. @RunWith( SpringJUnit4ClassRunner.class ) @ContextConfiguration( classes = {

Does if else concept available in feature file (Gherkin language)?

核能气质少年 提交于 2019-12-19 19:53:18
问题 Is there anyway where we can use if/else concept in feature file? For example: Scenario: User should be able to check login page Given I am on login page When I click on SignIn button Then I should be in home page If yes Then I will create a new profile Else Then I will logout from page 回答1: Not that I am aware of. Gherkin (and cucumber) are best used when they specify discreet business cases though, and should be repeatable, else they get hard to follow and test. It looks like you have two