I am new to cucumber. We have below use case for UI automation through cucumber.
Please consider below example.
in TestNg,
@Test {"formname"}
public void createAndSearchForm(String formName)
{
//In below step, it create form by name (formName-timestamp) and return the formname. e.g. it create form and return "formname-06042016184426"
// In this method we create form name by appending time stamp to formname passed to method. Since application didn't accept same name we need to append timestamp
// to formname.
String newFormName=createForm(formName);
// In below method we pass above newFormName and verify whether form is created or not by searching form name.
asserTrue(searchCreatedForm(newFormName));
}
Now we are moving to cucumber and we need to accomplish above example in cucumber.
Feature: Forms.
Scenario: Login to application
Given Create form with name “formname”
Then Search “formname”
Issue that we are facing -> The formname that is getting returned in step1, we don’t know how to pass it to step2 . Within scenario, We need to pass this form name to different step definition which is implemented in various classes.
I tried to search over the net however didn’t find anything specific to our need.
It will be great help if anyone could give us some pointers/suggestion.