Thucydides/Jbehave GivenStories problem

866 views
Skip to first unread message

gereleth

unread,
Jul 16, 2013, 4:29:04 AM7/16/13
to thucydid...@googlegroups.com
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.

John Smart

unread,
Jul 16, 2013, 5:57:05 AM7/16/13
to gereleth, thucydid...@googlegroups.com
I don't use GivenStories very much myself (I usually just use @Step methods within a single @Given), so they are probably not very extensively supported in the code - if anyone wants to take a look in the thucydides-jbehave module before I get time to look at it, I'd be happy to point them in the right direction.


--
You received this message because you are subscribed to the Google Groups "Thucydides Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thucydides-use...@googlegroups.com.
To post to this group, send an email to thucydid...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
___________________________________________________
John Smart | Wakaleo Consulting  |  +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com  |  john....@wakaleo.com

Dez Za

unread,
Sep 22, 2013, 9:21:19 PM9/22/13
to thucydid...@googlegroups.com
Has there been any progress in this area?  I see a JIRA has been raised but it doesn't look like it has moved along. Any update?

Cheers,
D

Eugene Nichegovskiy

unread,
Sep 23, 2013, 4:57:20 AM9/23/13
to thucydid...@googlegroups.com
I've tried the last snapshot of thucydides-jbehave plugin on my example: https://github.com/DrBlast/thucydides-168-issue
It workes fine. It's a high probability that the bug was fixed. But I have no time to explore all situations where I need to use GivenStories. 

Eugene
Reply all
Reply to author
Forward
0 new messages