Is it possible to run a specific java method after all of the @Given statements have completed for a specific scenario?

StackOverflow https://stackoverflow.com/questions/16972115

  •  31-05-2022
  •  | 
  •  

Domanda

Currently I have a story written like:

Given I login as a user
And that user likes computers
And that user has a car
When that user goes to school
Then he will be happy

I want to be able to execute a java login method after I have collected all of the Given statement data to login. Note: the last given statement changes between stories, and the user has different variables that could be assigned to that user.

Is it possible to do something like this?

È stato utile?

Soluzione

One alternative is you to use tabular parameters this way:

Given an user logs into application with:
|Id|Taste|Belongings|
|Bob|computers|car|

and this step method:

@Given("an user logs into application with: $loginInfo")
public void theTraders(ExamplesTable loginInfo) {
   callLoginProcedure(loginInfo);
}

you could see more details here.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top