Introduction
As of easyb 0.9.6, the notion of shared behaviors is supported; that is, you can create a base behavior (at this point it must live within the context of a single story (i.e. a file)) and then refer to that behavior inline using the keywords shared_behavior and it_behaves_as like so:
shared_behavior "shared behaviors", {
given "a string", {
var = ""
}
when "the string is hello world", {
var = "hello world"
}
}
scenario "first scenario", {
it_behaves_as "shared behaviors"
then "the string should start with hello", {
var.shouldStartWith "hello"
}
}
scenario "second scenario", {
it_behaves_as "shared behaviors"
then "the string should end with world", {
var.shouldEndWith "world"
}
}
The problem is when you produce an html report (-html with BehaviorRunnerTask? ) your don't see the details (given...when...then) of your shared behaviour
An additional (maybe temporary) tip for early adopters, got from andy's blog and source code : since version 0.9.8, shared behaviors can be shared by multiple stories: - put the shared behaviors in a dedicated story file (ex: shared.story) - referer to it from a story using following instruction:
I would agree with you the instruction is strangely named; but it's WIP !
It would be interesting to see more realistic example of shared stories. As it stands right now I don't see it approaching reusable steps in Cucumber - there is no clear readability of the features.