【发布时间】:2013-07-15 14:38:34
【问题描述】:
我在 Rest Assured 代码中有以下发布请求:
我想参数化它。请提出建议。
given().contentType(JSON).with()
.body("\"id\":"123",\"email\":\"abv@gmail.com\"}").expect().body("status",
notNullValue()).when().post("https://localhost:8080/product/create.json");
参数
身份证,电子邮件。
当我声明字符串变量 id,email 并尝试传入 body() 时,它不起作用。
不工作的代码:
String id="123";
String email=abc@gmail.com;
given().contentType(JSON).with()
.body("\"id\":id,\"email\":email}").expect().body("status",
notNullValue()).when().post("https://localhost:8080/product/create.json");
【问题讨论】:
-
可能并不重要,但你的身体开头似乎缺少一个开口花括号。
-
对不起,我错过了提供它。但我仍然遇到问题。
标签: java rest-assured