Why do need to put the before/after methods in Embeddable class and not in a steps class?
On 23 Sep 2013, at 22:39, "Corbin, J.D." <[email protected]> wrote: > Hi, that does work for an InstanceStepsFactory, but we are using a > GuiceStepsFactory. I'll have to see if there is a way to extend this factory > to support this. > > > > On Mon, Sep 23, 2013 at 3:29 PM, Mauro Talevi <[email protected]> > wrote: >> The JBehave lifecycle annotations must found in the steps classes. That >> said, you can register your class as a steps class. Just pass the "this" >> reference to the InstanceStepsFactory. >> >> On 23 Sep 2013, at 21:35, "Corbin, J.D." <[email protected]> wrote: >> >>> 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. >
