JBehave 面临的问题

发布于 2025-01-04 03:18:31 字数 747 浏览 1 评论 0原文

我已经创造了故事/场景。像:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

微暖i 2025-01-11 03:18:31

请确保您也有“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.

吖咩 2025-01-11 03:18:31

在我的测试中,挂起状态从第二个 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文