我想执行一个测试用例,尝试使用不同的凭据登录并检查错误消息。如何在 Cucumber 中做到这一点?
Feature: Login
Login Test Suite
Background:
Given I'm on the login page
Scenario: 01. Should not be able to login with invalid cred
When I log in with "username" and "password"
| username | password | ExpectedError |
| asdasd | anything | Invalid credentials specified |
| | anything | Please specify a username |
| asdasd | | Please specify a password |
| | | No username or password specified |
Then An error msg should appear
这是我要传递两个参数,用户名和密码的地方:
When('I log in with (string) and (string)', (username,password) => {
p.loginWith(username, password)
})