0

I am trying to automate one scenario using Cucumber.

Step Then Create item actually takes values from first row only.

What I want to do is execute step Then Create item 2 times, before moving to step Then assigns to CRSA.

But my code is taking values from first row only (0P00A). How to take values from both rows?

Background: Application login
    Given User launch the application on browser
    When User logs in to application
   

     Scenario: Test
            Then Create item
              | Item ID    | Attribute Code | New Value | Old Value |
              | 0P00A      | SR             |  XYZ21    | ABC21     |
              | 0P00B      | CA             |  XYZ22    | ABC22     |
     Then assigns to CRSA




  @Then("Create item")
    public void createItem(DataTable dataTable) {
        
        List<Map<String, String>> inputData = dataTable.asMaps();
        
        }
1

1 Answer 1

2

You can use foreach like below:

List<Map<String, String>> inputData = dataTable.asMaps(); 
   
  for (Map<String, String> columns : inputData ) {

         columns.get("Item ID");
         columns.get("Attribute Code");

}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.