I have a problem with running tests when I try to use Jbehave GivenStories (using Thucydides version 0.9.131-NS).
My story has 4 scenarios that each need some common precondition steps. At first these common preconditions were in the first scenario like this:
Scenario: Scenario 1
Given common precondition A
And common precondition B
And common precondition C
And precondition 1
When action 1
Then result 1
Scenario: Scenario 2
Given precondition 2
When action 2
Then result 2
...
However I didn't like seeing A,B and C steps in the report for Scenario 1. So I wanted to move preconditions A,B and C to a given story and put it on the story level like this:
GivenStories: path/to/my/given.story
Scenario 1:
Given precondition 1
When action 1
Then result 1
...
But now when I run the tests it seems that the whole story is treated like a single scenario. I only see one 'TEST STARTED' entry in the console output, and the report also displays the story as a single scenario where my scenarios in turn are listed as steps. Additionally no meta tags defined in the story file appear in the report.
Also if one scenario fails, the following ones fail with error
(java.lang.ClassCastException: net.thucydides.core.steps.StepInterceptor cannot be cast to my.company.testing.thucydides.steps.NavigateSteps)
When using GivenStories a failed scenario also causes a method marked with @AfterStory to be skipped. Without GivenStories this doesn't happen.
If I move a GivenStories: line to the first scenario then things work mostly fine. But in this case my given story appears in the report as a scenario and steals all steps from Scenario 1! Scenario 1 is shown as pending with no steps and all its steps are shown in the given story...
So can these GivenStories really be used? I'd appreciate any help on how they are supposed to work.