我发送的 json 请求是:
Given url applicationURL
And path 'applications'
And header Authorization = subscribeToken
And request:
{
"throttlingTier": "Unlimited",
"description": "sample app description",
"name": "TestbyKarate",
"callbackUrl": "https:/apistore-dev-dev-a878-14-ams10-nonp.qcpaws.qantas.com.au/callback"
}
When method post
Then status 201
* def applicationId = response.applicationId
* print 'applicationId is ', applicationId
Run Code Online (Sandbox Code Playgroud)
我在我的请求中发送名称,TestbyKarate但我想在每次测试运行时发送一个唯一值。
有什么办法吗?
我正在尝试运行一些测试,Delete.feature如果成功,则需要在每个场景结束时调用“”文件,但如果是失败测试,则不应调用“ Delete.feature”文件。
我的测试看起来像这样:
Given url ApiAdminURL
And path AdminPath
And header apigateway-apikey = apiGatewayKey
And header apigateway-basepath = 'lambdaTest'
* json myReq = read('users.json')
* set myReq.apiConf.subscriptionTiers = subscriptionTiers
* print 'my subscriptions : ', myReq.apiConf
And request myReq
When method post
Then status responseCode
* call read('Delete.feature')
Examples:
| subscriptionTiers |responseCode|
| [Unlimited,Gold,Bronze, Silver] |200 |
| [Unlimited,Gold,Bronze] |200 |
| [Unlimited,Gold,BronzeAuto-Approved] |400 |
Run Code Online (Sandbox Code Playgroud)
如果响应代码是200,那么它应该运行命令“ * call read('Delete.feature')”,如果responseCode是400,那么它应该跳过这个命令。
有人可以帮我吗?