我需要使用Cucumber.js检查404页面上的链接。所以我猜两件事。
Feature: Check broken links
Scenario: User clicks on links on web page
Given User is on website
And he clicks on link
Then he shouldn't see 404
And user returns back to click to another link on page
答案 0 :(得分:0)
您应该考虑使用Mocha进行此类测试,Gherkin不适用于循环等。有关详细信息,请参阅此答案:
答案 1 :(得分:0)
您可以使用场景轮廓并将网址传递为变量
Feature: Check broken links
Scenario Outline: User clicks on links on web page
Given User is on website
And he clicks on <link>
Then he shouldn't see 404
And user returns back to click to another link on page
Examples:
| link |
| http://www.google.com |
| http://www.gmail.com |