JBehave 面临的问题
我已经创造了故事/场景。像:
Scenario: Create a new Firm
Given a Firm Test
When Firm Test is valid
Then New Firm Test is Created
我已经使用以下给定创建了 Steps 类,然后注释如下:
@Given("a Firm $FirmName")
public void firm(String FirmName)
{
System.out.println("Firm Name : " + FirmName);
}
@When("Firm $FirmName is valid")
public void validateFirm(String FirmName) {
//validate the Firm Name and dates
System.out.println("Firm Name in when: " + FirmName);
}
而且我还有一个类,它负责配置(),candidateSteps()和storyPaths()方法。
现在,当运行该类时,JUnit 测试类不应该在firm() 和 validateFirm() 方法中打印上述两条语句吗?
尽管我有相同注释的方法,但我得到所有场景的 PENDING 状态的输出。
有人可以帮助我吗?
I have created the story/scenario. like:
Scenario: Create a new Firm
Given a Firm Test
When Firm Test is valid
Then New Firm Test is Created
I have created the Steps class with the following Given , Then annotations like:
@Given("a Firm $FirmName")
public void firm(String FirmName)
{
System.out.println("Firm Name : " + FirmName);
}
@When("Firm $FirmName is valid")
public void validateFirm(String FirmName) {
//validate the Firm Name and dates
System.out.println("Firm Name in when: " + FirmName);
}
And also I have an class in place which takes care of configuration(), candidateSteps() and storyPaths() methods.
Now when run the class a JUnit test class should not it print the two above statements in firm() and validateFirm() methods ?
I get an output with PENDING status for all the scenarios, though I have methods for the same annotations.
Could someone please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请确保您也有“Then”的注释。另一点是检查您正在执行的类是扩展 Junit 类的可嵌入类,而不是步骤类。
Please make sure you have annotation for "Then" as well. Another point is to check the class you're executing is the embeddable class that extends Junit class, not the steps class.
在我的测试中,挂起状态从第二个 Und(德语关键字)开始 - 如果我将故事文件中的 Und 一词更改为 Wenn,那么它将正确运行。
At my tests the pending status is starting at the second Und (keyword in german) - if i change the word Und in the story file to Wenn so it will be run correctly.