I have a class that extends JUnitStories and specifies two methods that use
the JUnit specific annotations @BeforeClass @AfterClass.  Inside of these
methods I do some initialization for my test scenarios, like propping up a
test server.   So the BeforeClass method starts the server and the
AfterClass method shuts down the server.

When I run the class that extends JUnitStories as a JUnit test, it executes
the methods annotated with the beforeclass and afterclass just as you might
expect.  All scenarios execute and succeed when running in this manner.

Now, when I run using maven (command line) and the jbehave-maven-plugin,
the JUnit (not really surprising) specific annotations are not executed and
therefore my server startup and shutdown logic is bypassed which prevents
my scenarios from executing.

How can I run the JBehave scenarios from the command line using Maven such
that my JUnit (or JBehave specific) annotated methods get executed?

I have tried using JBehave specific annotations like @BeforeStories,
@AfterStories,@BeforeTest, and @AfterTest (as well) in my class that
extends JUnitStories, but none of the methods with these annotations ever
get executed, either when running in Eclipse (as JUnit), nor Maven.

Any suggestions would greatly be appreciated.

J.D.

Reply via email to