I am trying to run jbehave stories in a sequence.
My package structure for Integration tests is shown below
src/it/some/package/name/packageA/a.story
src/it/some/package/name/packageB/b.story
src/it/some/package/name/c.story
I want the story to be run in this sequence a.story, b.story, c.story
I tried using GivenStories in jBehave but they didn't seem to work (may be I am not specifying them correctly). I would very much appreciate it if someone could point to the creation of GivenStories text and also show some insight as to how jbehave creates the ordering when it runs the Integration tests because I see that running stories on my machine and on jenkins seems to be yielding different execution ordering.
Any help on this is greatly appreciated. Thanks!
I actually figured out a work around on this issue which i thought was much convenient than GivenStories
First i added a maven surefire configuration like this
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<includes>
<include>**/*TesterSequence.java</include>
</includes>
</configuration>
</plugin>
The SampleTesterSequence would be structured like the one shown below
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({ A.class,B.class,
C.class })
public class SampleTesterSequence {
@BeforeClass
public static void beforeStories() throws Exception {
//TODO Implement before story steps
}
@AfterClass
public static void afterStories() throws Exception {
//TODO Implement after story steps
}
}
As you can see the the suite will run the stories a,b,c in the sequence i mention with the suite, when surefire runs the tests it looks for a pattern ending with TesterSequence
and will run that class first and from that class it executes the stories we want to run in that order specified.