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
  •  | 
  •  

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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top