Reputation: 872
I need to create a load test script using Jmeter for the some apis including this one:
https://myserver01.net/alert/bydate/${Today}
Now I use the date value manually , e.g everyday I manually change the date value in the request , e.g today I sent a request to https://myserver01.net/alert/bydate/2018-02-09. I want to make it automated so that whenever I run the test it will take todays date by default. I have seen this answers in the link http://www.jmeter-archive.org/way-to-get-current-date-into-a-variable-td512937.html but did not understand the methods. Like the first method says to define today in command line, which means I have to do it annually every time I initiate Jmeter. I want to avoid it and make it automated inside the script.
Upvotes: 2
Views: 14613
Reputation: 168147
Add the following entry there:
Today
${__groovy(new Date().format('yyyy-MM-dd'),)}
${Today}
where requiredMore information:
yyyy-MM-dd
pattern)Upvotes: 4
Reputation: 34566
It is as simple as using JMeter __time function:
https://myserver01.net/alert/bydate/${__time(yyyy-MM-dd,)}
To test functions, you can use Function Helper Dialog which allows you to test:
Upvotes: 3