在我的项目中,需要我从Endpoint 1获取user_id,
然后与端点 2 中的会话数据合并。
输入1:
{_user_id: "user1"}
输入2:
{
"_session_id": "5182d9fe-1f4f-484b-88c2-708f32cdd661"
},
{
"_session_id": "372cf574-2526-41ed-9a9b-77ecc50b0d66"
}
预期产量
{
"_user_id: "user1",
"_session_id": "5182d9fe-1f4f-484b-88c2-708f32cdd661"
},
{
"_user_id: "user1",
"_session_id": "372cf574-2526-41ed-9a9b-77ecc50b0d66"
}
空手道有办法实现这一点吗?
请使用空手道中设置的关键字
Feature: Merge JSON Payloads from different end points
Scenario: Merge JSON Payloads
* def response1 = { "_user_id": "user1" }
* print response1
* def response2 =
"""
[
{
"_session_id": "5182d9fe-1f4f-484b-88c2-708f32cdd661"
},
{
"_session_id": "372cf574-2526-41ed-9a9b-77ecc50b0d66"
}
]
"""
* print response2
* set response2[0]._user_id = response1._user_id
* set response2[1]._user_id = response1._user_id
* print response2