I am using Cucumber plugin in RestAssured to write my feature file and automate the REST service. Below is how my scenario looks like
Scenario Outline: Validate the elements in the GET response
Given I have the data setup to test "<version>" and "<order>"
When ...
Then the response should contain accurate data
Examples:
| version | order |
| V1 | O1 |
| V2 | O2 |
My step definition has the below signature for the method:
@Given("^I have the data setup to test \"([^\"]*)\" and \"([^\"]*)\"$")
public void iHaveTheDataSetupToTestAnd(String clientCharacteristicTypeCd, String clientCharacteristicDataType)
My question is I want to have another scenario like this below , where I want to leverage the same above step definition , but pass an additional parameter "special order" as optional. Can I do that or do I need to create a new step deifnition for just the below Given step ? I was thinking of method overloading / Passing Optional parameter but not sure if it works in Gherkin. Something like this
Ex:
Scenario Outline: Validate the elements in the GET response for special order
Given I have the data setup to test "<version>" and "<order>" and "<specialorder>"
When ...
Then the response should contain accurate data
Examples:
| version | order | specialorder
| V1 | O1 | SO1
| V2 | O2 | SO2
public void iHaveTheDataSetupToTestAnd(String clientCharacteristicTypeCd, String clientCharacteristicDataType, String specialOrder)