Alexander Lehmann edited a comment on Bug JBEHAVE-829

The problem comes from the fact that running the tests inside Eclipse or Maven works quite different from running it from inside a jar.

When running the story from the source files and classes inside Eclipse, you can use LoadFromRelativeFile and the storyPaths method can use findPaths to look up the actual files in the directory.

Eclipse will copy the story files to bin or target directory that will also be the directory for the class that jbehave is running from (the JUnitStories subclass), when running in maven, all files are in target as well.

When running inside the jar, the classes are found inside the jar which translates back to the local directory where is is located in, but the the findPaths methods looks in that directory and will not find anything.

For this to work in a jar, you have to change the StoryLoader to LoadFromClasspath(getClass()), however finding the stories will not work at all I think.

You can explicitly list your story files in the storyPaths method like this, this makes the stories run from the jar.

protected List<String> storyPaths()
{
  return Arrays.asList("stories/cx/lehmann/jbehave/jbehave_simple/stories/cleanup.story");
}

this is a bit inflexible however (if you change the list of your stories frequently) or read the list from a config file.

If you are running the stories from the classpath in Eclipse, you have to make sure that the classpath matches the paths for the stories, if the path doesn't match, the stories will not be found inside Eclipse or inside the jar.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to