我在其餘的保證代碼中有以下郵寄請求:使用Rest Assured的參數化郵寄請求有效負載
我想參數化它。請建議。
given().contentType(JSON).with()
.body("\"id\":"123",\"email\":\"[email protected]\"}").expect().body("status",
notNullValue()).when().post("https://localhost:8080/product/create.json");
參數
ID,電子郵件。
當我聲明字符串變量ID,電子郵件和嘗試傳遞身體()它不工作。
不工作代碼:
String id="123";
String [email protected];
given().contentType(JSON).with()
.body("\"id\":id,\"email\":email}").expect().body("status",
notNullValue()).when().post("https://localhost:8080/product/create.json");
也許並不重要,但一個大括號似乎在你的身體開始失蹤。 –
對不起,我錯過了提供。但仍然有問題。 – dileepvarma
意外地低估了你。我已將其標記爲主持人關注。希望他們能夠撤消它,因爲我沒有注意到我已經做到了,我的撤銷時間已經過期。 – Andrew