I am using Jbehave as my BDD framework. I am looking for a way to auto generate candidate step method stubs from the text scenarios like
Given there is a flight
And there is a customer
When the customer books the flight
Then the customer is shown on the manifest
to Java like this:
<@> Given("there is a flight")
<a@> Pending
public void thereIsAFlight() {
}
<@> Given("there is a customer") // note 'Given', even though story line is 'And'
<@> Pending
public void thereIsACustomer() {
}
<@> When("the customer books the flight")
<@> Pending
public void theCustomerBooksTheFlight() {
}
<@> Then("the customer is shown on the flight manifest")
<@> Pending
public void thenTheCustomerIsShownOnTheFlightManifest() {
}
Does JBehave provide it as an implicit functionality or people use some IDE plugin ? I'll highly appreciate any help here.
When you run JBehave it traces all steps that haven't found a matching binding code and dumps corresponding stub implementations as well, quite similar to what you wrote. This output is available on the console but also in the HTML reports (should you have them turned on). Copy them and place them into your steps class(es).
If you're asking to have JBehave automatically write the stub implementations into the .java files, then I highly doubt that there exists such a feature - it would be difficult to know which steps class & file to use. (Next to SCM integration problems and so forth.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With