如何在邮递员工具中参数化日期格式进行测试



下面的格式在正文中

"dateOfBirth":"[
1980,
6,
5
]",

我必须参数化(必须为每次迭代更改(使用 CSV 文件((。

提前致谢

在我看来,您有 2 个选择:

  1. 您可以在 CSV 数据文件中将其分开,如下所示:dateOfBirthYear,dateOfBirthDay,dateOfBirthMonth 1980,6,5 //1st iteration 1981,10,11 //2nd iteration etc. ...
  2. 您可以改用 JSON,例如:

[ { //here first iteration starts "dateOfBirth": [ 1980, 6, 5 ], "someOtherData: "string" },//here is the end of 1st iteration {//here second iteration starts "dateOfBirth": [ 1980, 6, 5 ], "someOtherData: "string" }//here is the end of 2st iteration ](不允许在 JSON 中注释(

然后,您可以在预请求脚本中使用它:

var dateArray = data.dateOfBirth但不要忘记这样的语法不起作用:{{data.dateOfBirth[1]}}(在 Url f.e 中(

最新更新