My situation is this:
I have a JBehave story containing multiple Scenarios. Each scenario writes some files, checks that they're as expected. Then the @BeforeScenario
for the next scenario causes the framework to delete the output files.
When some scenario is failing, I want to run just that scenario in isolation -- so I can conveniently examine the output file before it is deleted (and also for speed). Other people have asked the same question, and have been told "use Meta Filtering" - http://jbehave.org/reference/stable/meta-filtering.html - which seems to be the right tool.
But I don't want to go to the effort of annotating every other scenario with @skip
. I'd like to annotate just one scenario with @wip
, and run just that test.
I tried this:
Narrative:
An example story
Scenario: A scenario I don't want to run this time
Given foo
When bar
Then baz
Meta: @wip
Scenario: A scenario that is work in progress
Given foo
When bar
Then baz
... which I then run with an Embedder
configured thus:
embedder.useMetaFilters(Arrays.asList("+wip"));
This causes the whole story to be skipped, because the story doesn't match:
1 stories excluded by filter: +wip
However, if I annotate the story with @wip
, then both scenarios are run, because both inherit the wip
meta property.
Is there a neat way to achieve this?
The issue is simply that your Meta:
declaration belongs below the Scenario:
header.
So:
Scenario: A scenario that is work in progress
Meta: @wip
Given foo
When bar
Then baz
Now embedder.useMetaFilters(Arrays.asList("+wip"));
will achieve what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With