Automatically create stub candidate method stubs from stext scripts in JBehave

I use Jbehave as my BDD framework. I am looking for a way to automatically generate candidate steps method labels from text scripts such as

Given there is a flight And there is a customer When the customer books the flight Then the customer is shown on the manifest 

for Java:

 <@> 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 implicit functionality, or do people use some kind of IDE plugin? I appreciate any help here.

+6
source share
2 answers

When you start JBehave, it keeps track of all the steps that the matching binding code did not find, and downloads the corresponding stub implementations, very similar to what you wrote. This output is available on the console as well as in HTML reports (if you enable them). Copy them and put them in your classes (s).

If you ask JBehave to automatically write stub implementations to .java files, then I doubt very much that there is such a function - it would be difficult to know which class classes and files to use. (Next to SCM integration issues, etc.)

+5
source

i use IntelliJBehave: https://github.com/kumaraman21/IntelliJBehave/wiki it will not generate the method automatically, but it gives you some useful features, such as: syntax highlighting, navigation from method steps, error highlighting and much more.

0
source

Source: https://habr.com/ru/post/905060/


All Articles