API Masterminds - How to use dynamic properties to get today’s date?
Hello API Masterminds!
I’m sure you are already familiar with the Property Expansion syntax in ReadyAPI and often use it to transfer data from one part of your test to another.
But, did you know that with a similar syntax you can inject results of an arbitrary Groovy code execution to your tests and thus feed them with some dynamic data?
This functionality is called Dynamic Properties.
For example, you can insert a random number to a request body the following dynamic property as shown in the below screenshot:
${=(int)(Math.random()*1000)}
Each time you click the “Send“ button, the request body will contain a new random integer number.
Questions:
If you need today’s date in your test, what Groovy script would you use in the dynamic property for this?
If you already use dynamic properties in your tests, please share the use cases and provide script examples.