Rakesh,
1. Yes - Use JUnitStories as your "embedder" - or write your own.
2. That is more of a build question - in maven for example you
might bind cargo:redeploy to pre-integration-test and then
jbehave to integration-test.
3. Totally fine to do - that is what you will find in most of the
examples - you may also need @Before* methods to clear out those
variables as well.
What many people do is define an object that holds all their
data for their test(s) and then set/get that data as needed. Or
if you don't want that to be type-safe/defined,
then use a Map<String,Object> and use the key as the object
"name" (like request/session/application attributes in the
Servlet API). If you go multi-threaded, then you
will want to wrap those objects up in a ThreadLocal.
Hope that helps
Brian
----- Original message -----
From: rakesh mailgroups <[1][email protected]>
To: [2][email protected]
Subject: [jbehave-user] A few questions
Date: Wed, 4 Apr 2012 17:01:43 +0100
Hi,
I would like to ask:
1. Is there a way to avoid having to write a JUnit class per
story file?
2. If I need to do some tasks before running the tests once
(deploy war in my case) how would I do that?
3. My When section gets some data and my Then section asserts on
it. Is it ok to create an instance field in the Steps class and
assign in one step and use it in another? Seems a bit hacky.
Thanks
Rakesh
References
1. mailto:[email protected]
2. mailto:[email protected]