Alexander,

You can implement @BeforeScenario and @AfterScenario methods.
There are various parts of the lifecycle that you can hook into.
You can find those in the documentation

http://jbehave.org/reference/stable/annotations.html

Brian


----- Original message -----
From: "Alex Lehmann" <[email protected]>
To: [email protected]
Date: Thu, 29 Dec 2011 17:49:41 +0100
Subject: [jbehave-user] "Cleanup" steps at the end of scenario

I wonder if it is possible to have cleanup steps at the end of scenario, 
e.g. for deleting created records regardless if the previous steps were 
successful or not.

For example, I have written a scenario that checks for a XSS issue when 
entering user data. This is detected by checking 
assertThat(not(containsString())), which fails nicely when the issue is 
still present. Regardless if this fails or is successful I need to 
remove the entry for further tests. This can probably be done with a 
second scenario afterwards, but I think it would be clearer to have 
cleanup steps at the end of the scenario.

e.g.

Given user is logged in
When user enters "dangerous string"
When user clicks save
Then no "dangerous string" text is found

!-- cleanup, do always
When user enters ""
When user clicks save

bye, Alexander



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---
Brian Repko
LearnThinkCode, Inc.
http://www.learnthinkcode.com
email: [email protected]
phone: +1 612 229 6779


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to