Search code examples
seleniumselenium-webdrivercucumbercucumber-jvm

Cucumber step with multiple DataTables


How can I write a Cucumber step that has two DataTables?

How it should be written in the feature file?

For example , a step to drag a row from one table to second table:

When I drag a row from  
   | column_table1 |   
   | object1       |  
to   
   | column_table2 |   
   | object2       | 

Solution

  • There is no special syntax to add a second table. Just add it.

    When I drag a row from:
    | column_table1 |   
    | object1       |  
    And I drop it at:
    | column_table2 |   
    | object2       |  
    

    AFAIK, you can only have one table per step, but you can have as many steps with tables as you want. One way I approach the problem is storing the tables in a variable to often reference in a third step:

    Given I have a source row from:
    <table>
    And I have a destination row at:
    <table>
    When I drag from the source row and drop at the destimation row
    Then .....