Reputation: 65
I have this scenario
Scenario: Create draft OI Unilever-Fibra-2
Given User "analista.finance.ice.01@cashlink" and password "1" is logged
Then menu "OI / Criação Draft OI" should not be displayed
I have a method that access menu, and if I pass the step then to this method, it is gonna throw a exception, how do I make this exception turn my step TRUE
Upvotes: 1
Views: 1133
Reputation: 4323
I would probably catch the expected exception and return true.
That answers your question.
I would consider looking again at your scenario. It is filled with details about the implementation.
I would probably move those details to the step. Or perhaps even to a helper method that the step uses. Pushing these details down the stack would enable you to rephrase your scenario so it talks about what the behaviour is and not how it is implemented. By doing so, you might be able to rephrase it to something the actual business users can relate to.
Scenario: Create draft OI Unilever-Fibra-2
Given Rogger is not allowed to edit drafts
When he logs in
Then should the draft menu not be available
The benefit of this is that it is easier for a business person to read and validate that this is the wanted behaviour. The original phrasing is harder to read.
Pushing details down in the stack allows you to move the details about a thrown exception into the domain of programming, where it belongs, and focus on the wanted behaviour of your application in the features.
Upvotes: 1