問題描述
如何在 Ready API 中動態創建屬性? (How to create properties in Ready API dynamically?)
我正在使用 ReadyAPI 自動測試 Restful 服務。
一個測試用例有兩個 GET 請求步驟(比如 GETCARDS 和 GETCARDDETAILS)。
GETCARDS 返回一個 Cardnumbers 數組(不是固定大小)。我需要在第二個請求 GETCARDDETAILS 中使用這些卡號並一一運行它們。
為此,我計劃根據 Cardnumbers arrarsize 動態創建變量/屬性並存儲每次運行的值。稍後在第二步 GETCARDDETAILS 中使用這些值。在動態創建和存儲響應中收到的值時需要幫助。
參考解法
方法 1:
Not sure if this would help but you may try to come up with a Groovy Script step within your test case which dynamically create variables based on your desired scenario and transfer the property to your next test step based on the image explanation below from ReadyAPI.