cucumber-jvm

Groovy closure to implement matcher in Fest

旧时模样 提交于 2020-01-04 13:40:00
问题 I am trying to create a closure matcher for Fest with Groovy (2.1.6) like this: def matcherLabel = [ isMatching: { JLabel label -> /* do something */ } ] as GenericTypeMatcher<JLabel> GenericTypeMatcher is an abstract class with one method only to implement (isMatching (T t)) but I get this error: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Error casting map to org.fest.swing.core.GenericTypeMatcher, Reason: null at org.codehaus.groovy.runtime.DefaultGroovyMethods.asType

Cucumber-Appium - Where to store Hooks if initialising driver in @Before

独自空忆成欢 提交于 2020-01-04 07:27:48
问题 I'll try to explain how I've built this, I imagine something obvious may jump out. I'm relatively new to this but am building a cucumber-appium framework and am running into some trouble. Currently, I initialise my Appium driver in my @Before hook which is in a GlobalHooks class which contains all Hooks. I have altered the hook so part of it only runs at the start of the test run as Cucumber doesn't support global hooks and I don't see why I should initialise the driver before every test (I'm

Configuring cucumber-guice

让人想犯罪 __ 提交于 2020-01-04 03:26:53
问题 I am trying to use DI in my step definitions. I have a module, public class MyModule extends AbstractModule { private final static MyInterface INSTANCE = new MyInterfaceImpl(); @Override protected void configure() { bind(MyInterface.class).toInstance(INSTANCE); } } and want to inject this instance in the constructor of the step definitions. public class MyStepDefs { private final MyInterface instance; @Inject public MyStepDefs(MyInterface instance) { this.instance = instance } } I think I

cucumber tags based on maven profile

≯℡__Kan透↙ 提交于 2020-01-02 19:12:01
问题 I am trying to run specific Gherkin scenarios based on the variable @tags(if it is possible). For example, if my profile is "dev" I want to run scenario 1 and if profile is "qa" I want to run scenario 2. I can get the profile value in my java class. I can also pass the tags in the command line and run it as mentioned here. But that is not something I am looking for. For example: @QA Scenario:I do x and check y Given I do abc Then the response is 200 @DEV Scenario:I do y and check x Given I do

cucumber tags based on maven profile

会有一股神秘感。 提交于 2020-01-02 19:11:22
问题 I am trying to run specific Gherkin scenarios based on the variable @tags(if it is possible). For example, if my profile is "dev" I want to run scenario 1 and if profile is "qa" I want to run scenario 2. I can get the profile value in my java class. I can also pass the tags in the command line and run it as mentioned here. But that is not something I am looking for. For example: @QA Scenario:I do x and check y Given I do abc Then the response is 200 @DEV Scenario:I do y and check x Given I do

Tests on test(AVD) - failed: Instrumentation run failed due to 'java.io.IOException'

有些话、适合烂在心里 提交于 2020-01-01 16:47:48
问题 I get this error when running my Cucumber-jvm tests with Gradle on an Android emulator . The exact same tests run perfectly on a device but I need to run them on emulator to perform the tests on Travis CI The debug error: Executing task ':app:connectedDebugAndroidTest' (up-to-date check took 0.0 secs) due to: Task has not declared any outputs. deleteDir(/home/travis/build/neoranga55/Experiment-CI/app/build/outputs/androidTest-results/connected) returned: true deleteDir(/home/travis/build

How do I set the path to my Cucumber features using cucumber-junit?

烈酒焚心 提交于 2019-12-29 04:14:49
问题 I try to build my first executable specifications with Java and Maven. I created a simple project with this structure: specification |-src |-test |-java |-mypackage |-MyFeatureTest.java |-resources |-MyFeature.feature In the junit test MyFeatureTest.java I have this: import org.junit.runner.RunWith; import cucumber.junit.Cucumber; @RunWith(Cucumber.class) public class HomepageTest { } Now https://github.com/cucumber/cucumber-jvm/wiki/IDE-support says that I should add the following line:

Cucumber (Java) via Windows command line works via batch, but not pom

不问归期 提交于 2019-12-25 06:22:31
问题 I'm running through the examples in the Cucumber For Java book on the Windows command line. I can execute it fine from a Windows batch file, but when attempting to do it from Maven, I'm getting "No sources to compile" and "No tests to run". What is needed in the pom to point to the same classes/features as in the batch? Full output: [C:\data_jeffy\code\java\cucumber\learning_cucumber\first_taste\checkout]mvn clean test [INFO] Scanning for projects... [INFO] [INFO] ----------------------------

How rerun failed test cases of cucumber-jvm in jenkins

无人久伴 提交于 2019-12-24 17:51:45
问题 How to rerun failed test cases of cucumber-jvm in jenkins? According to answers mentioned in this thread: How to rerun failed test cases in cucumber-jvm? There is different maven command to move and run scenarios for rerun.txt. How to execute them in Jenkins with separate maven command for rerun? 回答1: I use cucumber-serenity framework, which uses cucumber-jvm in the background to run everything. Here are the relevant parts of my pom. I have everything in a separate project, not mixed with any

How to run a Cucumber-JVM feature file from the command line

◇◆丶佛笑我妖孽 提交于 2019-12-24 16:47:44
问题 I have a file with file extension .feature . HOw do run this from the command line? In order to make a batch file for each feature. I am using Cucumber-JVM with Java and Selenium. 回答1: Cucumber-JVM is based on JUnit so its just like running any unit tests from the command line java -cp /path/to/junit.jar org.junit.runner.JUnitCore [test class name] where test class name is annotated with @CucumberOptions whose features refer to the feature file. If youre using Maven you could use mvn test 回答2