On Mon, Sep 3, 2012 at 11:06 AM, bond_007 <
agile...@gmail.com> wrote:
> Can you please give more details on sharing step definition.
Avoid feature-coupled step definitions:
https://github.com/cucumber/cucumber/wiki/Feature-Coupled-Step-Definitions-(Antipattern)
> Did you mean to
> include only 'public' without method name
>
> I had similar problem where steps are common between two features file. For
> me it says "Duplicate step definitions" error
What part of the error message is unclear to you?
Aslak
> Following are the details
> ------------------------
> When I run the command
> mvn -e -Dtest=DeleteRecordTest clean test
> I get the following
> Tests in error:
> initializationError(com.company_name.projectname.test.DeleteRecordTest):
> Duplicate step definitions in
> com.company_name.projectname.steps.DeleteRecordStepdefs.i_am_on_the_home_page()
> in file:/C:/workspace/project-name/target/test-classes/ and
> com.company_name.projectname.steps.AddRecordTestStepdefs.i_am_on_the_home_page()
> in file:/C:/workspace/project-name/target/test-classes/
>
>
> Two different Features definitions
>
> addRecord.feature
> Feature: add a record
> As a user I want to add items from home page
>
> Scenario: add item
> Given I am on the home page
> When I click the add items in the home page
> Then the added item should be added to the list
> deleterecord.feature
> Feature: add a record
> As a user I want to delete items from home page
>
> Scenario: add item
> Given I am on the home page
> When I click the delete items in the home page
> Then a confirmation message should be displayed
> And the item should be removed to the list
>
>
> Package structure
> ----------------------------------
> src/main/java
> com.company_name.projectname.pages
>
> src/test/resources
> com.company_name.projectname.cucumber
> addRecord.feature
> deleteRecord.feature
>
> src/test/java
> com.company_name.projectname.steps
> AddRecordStepdefs.java
> DeleteRecordStepdefs.java
> com.company_name.projectname.test
> AddRecordTest.java
> DeleteRecordTest.java
>
>
>
>
> ----------------------------------------------------
> Test details
> ---------------
> DeleteRecordTest.java
> ====================
> @RunWith(Cucumber.class)
> @Cucumber.Options(
> features =
> "classpath:com/company_name/projectname/cucumber/deleteRecord.feature",
> glue = {"com.company_name.projectname.steps"},
> format={"pretty", "html:target/cucumber"}
> )
> public class DeleteRecordTest {
>
> }
>
> ---------------
> AddRecordTest.java
> ====================
> @RunWith(Cucumber.class)
> @Cucumber.Options(
> features =
> "classpath:com/company_name/projectname/cucumber/addRecord.feature",
> glue = {"com.company_name.projectname.steps"},
> format={"pretty", "html:target/cucumber"}
> )
> public class AddRecordTest {
> --
> -- Rules --
>
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers
>
http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
> 3) If you have a question, don't reply to an existing message. Start a new
> topic instead.
>
> You received this message because you are subscribed to the Google Groups
> Cukes group. To post to this group, send email to
cu...@googlegroups.com. To
> unsubscribe from this group, send email to
>
cukes+un...@googlegroups.com. For more options, visit this group at
>
https://groups.google.com/d/forum/cukes?hl=en
>
>