I have a framework for native iOS testing which utilizes Appium, TestNg, Cucumber, PicoContainer
And I`m looking for best way to store data fetched from one step/scenario that later can be used to assert another scenario
Example: Scenario: user can answer on survey question Given User answers on Survey Question with {var1} Then success screen displayed
Scenario: previously answered question has value that user sent initially Given user on reviewMyAnswers screen Then answer hold value of {var1}
I just give generic example. In reality i have a lot of data like this that need to be validated and i want to store answer from first scenario in separate class and then retrieve it when needed by key and value pairs somehow like that
public classWhereIstoreTestData() {
ANSWER1;
ANSWER2;
PRODUCT1;
ETC...;
}
@Given(User answers on Survey Question with {var1}{
poSurvey.AnswerOnQuestion;
classWhereIstoreTestData().setValue(key.Answer1,value.poSurvey.getAnswerValue)
@Then(answer hold value of {var1}{
assertThat(classWhereIstoreTestData().getValue(key.Answer1),equalsTo(poSurvey.GetAcceptedAnswerValue)
I`ve seen tutorials (there are just couple on google) , but could not get them They all seem much more complicated then they suppose to be
My app is not too big and i guess i gonna be using just one stepdefs file. But i still don't want to use static variables for this purpose cause I'm planning to use parrallelization in future