Just bear in mind that JBehave creates two candidate steps, one for the
Given and one for the When, which are treated as being independent.
On 09/08/2012 10:26, Jitendra Singh Bhati wrote:
Yes Brooks, you can use the code suggested by you.
On Wed, Aug 8, 2012 at 10:01 PM, Foley, Brooks (GE Healthcare)
<[email protected] <mailto:[email protected]>> wrote:
I am new to JBehave and the group so I apologize if this is a
basic question.
In my stories I have statements that I reuse in both the Given and
When context:
*Given*I set foo to 3
*When*I set foo to 3
In my steps code I have
@Given("I set \"$field\" to \"$value\"")
*public**void*set(String field, String value){.....
}
@When("I set \"$field\" to \"$value\"")
*public**void*whenset(String field, String value){.....
}
The code for both is the same. Can I use the following?
@Given("I set \"$field\" to \"$value\"")
@When("I set \"$field\" to \"$value\"")
*public**void*set(String field, String value){.....
}
If not is there another option to avoid duplicating the code?
Thanks
--
Regards,
Jitendra