I am trying to integrate jBehave into our project. Due to legacy reasons this project has some rather complex hierarchy of abstract/base test classes which contain lots of code I need to use in my jBehave stories.
Therefore, I am looking for ways to run jBehave stories without having to extend JUnitStory or JUnitStories - instead, I'd be extending our own base classes.
Is there a way to hook in jBehave into a regular jUnit test, without extending JUnitStory(es)?
The logic of the very simple method can be extracted from JUnitStories
:
Embedder embedder = ...; // prepare Embedder
List<String> storyPaths = ...; // create a list of story paths to execute
try {
embedder.runStoriesAsPaths(storyPaths);
} finally {
embedder.generateSurefireReport(); // optional, only if Surefire report is needed
}