我是空手道框架的新手。我想写一个像这里这样的场景:
version 1 :
Background:
* url 'someURL'
* def user1 = {id:'123', name:'Bill'}
Given I have a user with id '123'
When I create a new user with the same id
Then I should get a response 'user with this id already exists'
但在空手道中,我必须像这样写:
version 2 :
Background:
* url 'someURL'
* def user1 = {id:'123', name:'Bill'}
Given request user1
When method post
Then status 201
Given path response.id
When method get
Then response == {id:'123', name:'Bill'}
* def idUser1 = response.id
Given request == {id: idUser1, name: 'Gary'}
When method post
Then response == {code: 400, message: 'user with this id already exists'}
如何使用空手道框架获得第一个版本?我必须在哪里详细说明 3 行?例如:
Given I have a user with id '123'
在后面(我不知道在哪里以及如何)详细说明
"Given request user1
When method post
Then status 201
Given path response.id
When method get"
Then response == {id:'123', name:'Bill'} etc.