这个SpecFlow场景是否正确?

时间:2016-03-02 14:55:53

标签: selenium selenium-webdriver cucumber specflow gherkin

这是我用Gherkin编写的第一个更“复杂”的SpecFlow场景。请向我提供有关其质量的任何反馈:

Scenario: CompanyUpload
    Given admin (user) log in to admin-site
    When user enters Uploading page
    And user downloads Company Upload template
    And template is updated by script
    And user opens Company upload form
    And user fills it with proper data
    And user submit filled form
    Then new job should be added to the queue (visible in table form)
    And job status should be "In Queue" for not longer than 10 minutes
    And job status should be updated to "Processing" and shouldn't take more than 4 minutes
    And final job status should be "Succeeded"

此方案已使用Selenium Webdriver操作进行编码。现在,我想用SpecFlow来介绍它以创建验收测试库。

1 个答案:

答案 0 :(得分:3)

功能应该关注行为而不是实现。因此,在您的功能中添加附带细节并不是一个好主意。在你的例子中,我说你的步骤有点碎片。而是使用6来描述用户上传内容的 步骤,使用一两个来描述用户所做的 。例如。

When user uploads document using company upload template

这样的事情描述了必要的细节但不仅仅是这些细节。