Try using:
List<String> storyPaths = new
StoryFinder().findPaths(CodeLocations.codeLocationFromClass(this.getClass()),
"**/*.story", null);
Have a look at the examples:
http://jbehave.org/reference/stable/running-examples.html
Or consider using a Maven archetype to get started:
http://jbehave.org/reference/stable/archetypes.html
Cheers
On 15/04/2013 19:25, Kendall Shaw wrote:
How can I associate a steps class with a story? It would be great if I
could somehow indicate: use this class with this story.
So far, all of my attempts have resulted in no stories being found.
From main:
Embedder emb = new Embedder();
List<String> stories = Arrays.asList("stories/test_steps.story");
emb.candidateSteps().add(new TestSteps());
emb.runStoriesAsPaths(stories);
stories/test_steps.story:
Story: A story
Scenario: A something and something else
Given a something
Then something else
public class TestSteps extends Steps {
@Given("a something")
public void givenASomething() {
System.out.println("givenASomething()");
}
@Then("something else")
public void somethingElse() {
System.out.println("somethingElse()");
}
}
the result is:
Exception in thread "main" org.jbehave.core.io.StoryResourceNotFound:
Story path 'stories/test_steps.story' not found by class loader
sun.misc.Launcher$AppClassLoader@4c5a9c6e
"stories" is on the classpath. I've also copied code from the
AnnotatedEmbedder class from the documentation. The part:
new
StoryFinder().findPaths(CodeLocations.codeLocationFromPath(getClass()), "**/*.story",
"");
finds the story (I copied it into the source directory).
The result is that the test completes with 0 steps and 0 stories.
Is there some part that I am missing?
Kendall
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email