如何在 Specflow 中参数化表?这是我的功能文件 -
功能:登录
As a User,
should land on ***** Login page
Enter valid Username and password
Home page displayed-Validate Logout link
Run Code Online (Sandbox Code Playgroud)
场景:成功登录鉴于我在 **** 登录页面当我输入自动化和自动密码时,应显示注销链接
Scenario: Successful parameterized Login
Given I am on **** Login page
When I enter:
| Username | Password |
| automation | autopassword |
| misc | misc123 |
Then the Logout link should be displayed
Run Code Online (Sandbox Code Playgroud)
这是我的查询 - 我想使用第二行值测试登录 - misc & misc123。我如何使用硒调用它?如何让参数化的部分成为一个完整的场景集-考虑到登录后还有更多的场景?测试运行第一行的完整功能,然后作为第二行执行测试登录。
不要使用 Table 元素,而是将其转换为Scenario Outline。所以你的场景会变成。
Scenario Outline: Successful Login
Given I am on **** Login
When I enter <UserName> and <Password>
Then the logout link should be displayed
Examples:
| UserName | Password |
| Foo | Bar |
| Bar | Foo |
Run Code Online (Sandbox Code Playgroud)
这将贯穿每组示例。
| 归档时间: |
|
| 查看次数: |
831 次 |
| 最近记录: |