how to access steps available in other cucumber project in current cucumber project

64 views
Skip to first unread message

reddy

unread,
Jun 21, 2016, 5:48:39 AM6/21/16
to Cukes

Please help me understand accessing steps available in other cucumber projects in current cucumber project. i have tried glue option as well and i also have added other cucumber project jar file in maven dependencies but could not make it work.

Below is the feature file of project1: 


Feature: To test cucumber test is running I want to run a sample feature file.

     Scenario: cucumber setup

    Given sample feature file is ready1
    When I run the feature file1
    Then run should be successful1

    Scenario: cucumber setup for cucmbertestautomation2

    Given sample feature file is ready2
    When I run the feature file2
    Then run should be successful2


"Given sample feature file is ready2" step is available in project2.

and project1 (cucumbertestautomation1) POM have project2(cucumbertestautomation2) as dependency, like shown below.


<dependency>

<groupId>com.celcom</groupId>

<artifactId>cucumbertestautomation2</artifactId>

<version>0.0.1-SNAPSHOT</version>

</dependency>



Still the step "Given sample feature file is ready2" is not recognized.

Serguei Cambour

unread,
Jun 23, 2016, 4:34:08 PM6/23/16
to Cukes
So, as you mentioned POM file and dependencies, you are talking about cucumber-jvm. Right ?
Step definitions is just Java classes defined in some packages inside a project test folder. And all of them should NOT be used for other than adding some steps (methods) to be read by Cucumber. So why do you need to have access to the same feature already defined in another project ?  It means that you are trying to code the same feature and hoping to match to a step already defined in another project ? You can't. It is not like you are trying to acces some classes just because you have them provided in the jar. 
That's beacuse of how Cucumber reads its glue code (steps definitions) with which Cucumber glues the features to your application. Cucumber treats the packages you specify as a root from which to scan for glue code.
Reply all
Reply to author
Forward
0 new messages