Cucumber中如何划分功能和场景?

发布于 2024-09-27 17:05:56 字数 63 浏览 0 评论 0原文

我需要管理系统中的一些用途,所以用户管理是一个功能,而添加/删除用户是一个场景?我想知道设计它们的一个原则,谢谢

I need to manage some uses in system, so user management is a feature , and add/delete user is a Scenario? I want to know one principle to design them, thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

小苏打饼 2024-10-04 17:05:56

是的,你是对的。

# user-mgmt.feature
Feature: User management

    Scenario: User addition
        Given that no user named 'doe' exists
        When I create an account for 'doe'
        Then the list of users will include a record for 'doe'

    Scenario: Deletion of non-existing user
        Given that no user named 'doe' exists
        When I remove the account 'doe'
        Then I get an error message

另请参阅如何创建更简洁的功能和 < a href="https://github.com/cucumber/cucumber/tree/master/examples" rel="nofollow">git 示例。

我的建议是只创建一个功能文件并运行cucumber。它会告诉你该怎么做。

Yes, you are correct.

# user-mgmt.feature
Feature: User management

    Scenario: User addition
        Given that no user named 'doe' exists
        When I create an account for 'doe'
        Then the list of users will include a record for 'doe'

    Scenario: Deletion of non-existing user
        Given that no user named 'doe' exists
        When I remove the account 'doe'
        Then I get an error message

Have also a look at how to create more concise features and the git examples.

My advice is to just create a feature file and run cucumber. It will tell you what to do.

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