请我需要帮助,如何联系json的两个回复消息? (姓名或姓氏)
[print] [
{
"bindingFailure": false,
"code": "NotEmpty",
"field": "name",
"defaultMessage": "Name is empty",
...
[print] [
{
"bindingFailure": false,
"code": "NotEmpty",
"field": "surname",
"defaultMessage": "Surname is empty",
...
功能及其:
Scenario Outline:
...
When method POST
Then status 400
And match $.status == 400
And match each response.errors contains { defaultMessage: 'Name is empty'} || { defaultMessage: 'Surname is empty'}
Examples:
| Name | Surname |
| '' | Smith |
| Joe | '' |
任何想法可能有什么问题吗?
谢谢!
答案 0 :(得分:0)
也许您错过了此选项:
And match each response.errors contains { defaultMessage: '#(Expected)' }
Examples:
| Name | Surname | Expected |
| '' | Smith | Name is empty |
| Joe | '' | Surname is empty |
但是,也不要过载测试。请仔细阅读以下内容:https://stackoverflow.com/a/54126724/143475