Reputation: 974
I am using Codeception PHP with Gherkin language (.feature file extension). I tried to find an idiomatic way of sharing state between steps in a scenario. In my case the step implementation are NOT contained in the same class. I could share the state through some globals but I am thinking of a more idiomatic way. In fact I would love to store the state on Scenario level.
I already asked ChatGPT about this and got the hallucinated answer, that I could use the getState
and setState
methods on the Scenario
object, which would have been ideal. But as I said, this was hallucinated, those methods do not exist.
As a workaround I will create some class with static members that keep that state. But as I said, I am more interested in the idiomatic way of doing this.
@CloudPanelUserResource
@Mailpit
Scenario: Invitation
When I invite a cloud panel user
Then I see user in user list with status "invited"
* An invitation mail is sent
CloudPanelUserResource
-tag is configured to include a Page
object and Mailpit
comes with a Step
class configured.
That means, that the step An invitation mail is sent
is implemented in another class.
Upvotes: 0
Views: 24