我在其余的保证代码中有以下邮寄请求:使用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