场景大纲中的零值在示例中被视为空手道中的字符串
reqres.feature ,
Feature: Reqres api test cases
Scenario Outline: register user post -data driven test of negative scenarios
Given url 'https://reqres.in/api'
And path 'register'
And def payload =
"""
{
"email": "<email>",
"password": "<password>"
}
"""
And request payload
When method post
Then status 400
* print response
* match response == <errorResponse>
Examples:
| email | password | errorResponse |
| null | null | {"error": "Missing email or username"} |
因此我得到了响应{ “错误”:“注意:只有定义的用户成功注册” }而不是此响应{“错误”:“丢失电子邮件或用户名”}。如何解决这个问题?
reqres.feature
Feature: Reqres api test cases
Scenario Outline: register user post -data driven test of negative scenarios
Given url 'https://reqres.in/api'
And path 'register'
And def payload =
"""
{
"email": "<email>",
"password": "<password>"
}
"""
And request payload
When method post
Then status 400
* print response
* match response == <errorResponse>
Examples:
| email | password | errorResponse |
| null | null | {"error": "Missing email or username"} |
Because of this I am getting response {
"error": "Note: Only defined users succeed registration"
} instead of this response {"error": "Missing email or username"}. How to solve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Please spend some time reading the docs here: https://github.com/karatelabs/karate #场景外线 - 增强
我在下面重新编写了您的测试。请注意
!
后缀在示例中的使用:
列名。Please spend some time reading the docs here: https://github.com/karatelabs/karate#scenario-outline-enhancements
I have re-written your test below. Note the use of the
!
suffix in theExamples:
column names.