从JBehave中的stext场景中自动生成候选步骤方法存根

Bhu*_*tap 6 bdd jbehave

我使用Jbehave作为我的BDD框架.我正在寻找一种从文本场景中自动生成候选步骤方法存根的方法

Given there is a flight
And there is a customer
When the customer books the flight
Then the customer is shown on the manifest
Run Code Online (Sandbox Code Playgroud)

像这样的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() {
}
Run Code Online (Sandbox Code Playgroud)

JBehave是将其作为隐式功能提供还是人们使用某些IDE插件?我非常感谢这里的任何帮助.

der*_*eha 5

当您运行JBehave时,它会跟踪所有未找到匹配绑定代码的步骤,并转储相应的存根实现,这与您编写的内容非常相似.此输出可在控制台上使用,也可在HTML报告中使用(如果已打开它们).复制它们并将它们放入您的步骤类中.

如果您要求JBehave自动将存根实现写入.java文件,那么我非常怀疑存在这样的功能 - 很难知道要使用哪些类和文件.(SCM集成问题旁边等等.)