Well in that case, why not simply define a step and add it at the end.

If it's the keyword that you're after, you can define a synonym for an existing keyword, e.g. Then=Then|Finally, in the keywords_<locale>.properties

http://jbehave.org/reference/stable/keyword-synonyms.html

On 28/05/2015 11:25, Alberto Scotto wrote:

I see, but I was hoping for a smaller "scope": just a single scenario, rather than an entire story.

1. In the wider scope it may distract.

2. Plus, it seemed reasonable to me completing the range of steps that are provided with one specific for tear down. We provide " given " for the setup logic specific to a single scenario: why not providing a step for the specular operation?

Alberto Scotto
http://alb-i986.me
[on Android]

Il 22/mag/2015 02:04 PM, "Mauro Talevi" <[email protected] <mailto:[email protected]>> ha scritto:

    You can use the Lifecycle After steps:

    http://jbehave.org/reference/stable/story-syntax.html

    On 21/05/2015 17:17, Alberto Scotto wrote:
    Hi

    While issues cannot be opened on jira.codehaus nor on github as
    the issues section is not enabled, and before I forget, I'll
    write a feature request here.

    So the thing is this.
    Do we have a way to implement the tear down phase of a test,
    where the actions to be performed are different from test to
    test, therefore a |@BeforeScenario |does not suit very well?

    We have Given steps to implement the setup phase of a test,
    When/Then steps for exercising the system and for verifications,
    so why not defining a "Finally" step to implement custom (I mean:
    different from test to test) tear down logic?

    Here is a simple use case.

    Given I am logged in
    And I have a file to upload
    When I upload the file
    Then the file should be displayed on the system
    Finally delete the file

    Say that I want to upload a file with a unique name every time.
    A solution may be to keep a template in src/main/resources
    (version controlled) and have it copied every time (e.g. to
    "filename_$date_time") by the Then step.
    So here the file should be deleted at the end of the test.

    Of course, the Finally step should be handled in a special way by
    JBehave, having a similar meaning as an @AfterXX annotation:
    - it must be the last step(s) in a scenario
    - it must be executed even though the previous steps threw exception

    Let me know your thoughts.
    Thanks

    Alberto
-- You received this message because you are subscribed to the
    Google Groups "JBehave Dev" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected]
    <mailto:[email protected]>.
    To post to this group, send email to [email protected]
    <mailto:[email protected]>.
    To view this discussion on the web, visit
    
https://groups.google.com/d/msgid/jbehave-dev/b3feff91-2570-4303-9c26-673097e0132b%40googlegroups.com
    
<https://groups.google.com/d/msgid/jbehave-dev/b3feff91-2570-4303-9c26-673097e0132b%40googlegroups.com?utm_medium=email&utm_source=footer>.
    For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "JBehave 
Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/jbehave-dev/55682D78.5040708%40aquilonia.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to