let today = pm.collectionVariables.get("currentDate");
let newdate = new Date(today);
pm.variables.set("startDay", new Date(newdate.setDate(28)).toLocaleDateString('en-US'));
It returns date in the format: 10/28/2023
Further this date use in the request:
Yes, “currentDate” exists in JSON format.
Basic test logic:
There is a base date - “baseDate”. This is a date in the future.
Next, a certain test package is executed with this date.
After this, the date is increased by 1 day and the tests are run again. The variable “currentDate” gets the current day.
This is an emulation of the operation of services in the future several months in advance.
In this particular case, the variable “startDate” is needed for one of the services to generate the correct request in the future. This variable is local and generated in the pre-script and then passed to the body of the request.
Yes, sure.
This is how the variable is passed to the body of the request. The variable is of type string, so it is in quotes.
What other options are there?