有人知道如何使用不同的参数来运行这个空手道测试吗?在我使用硬编码值“USA”添加带有参数的表之前,测试正在工作。
@tag1
Scenario: Business User Sign Up
* table regions
| region |
| 'USA' |
Given header Content-Type = applicationJsonHeader
When url identitySignUpUrl
And header Authorization = auth
* def requestBody = read('classpath:resources/test.json')
* replace requestBody.userName = userNameInput
* replace requestBody.phoneNumber = phoneNumberInput
* replace requestBody.country = '#(region)'
And request requestBody
When method POST
Then status 200
* def errors = response.errors
And match errors == '#null'
* print response
这似乎不起作用https://github.com/karatelabs/karate#data-driven-features
我在下面重写了你的测试。我认为您缺少一些基础知识,因此请仔细阅读文档:https://github.com/karatelabs/karate#data-driven-tests
您肯定以错误的方式使用了
replace
- 并且不需要它。
Scenario Outline: business user sign up
* def body = { foo: 'bar' }
* body.userName = 'baz'
* url 'https://httpbin.org/post'
* request body
* method post
* status 200
Examples:
| region |
| usa |