Forum Discussion
KarelHusa
Champion Level 2
in such a case, you can save your reponses with the date in the filename (e.g., response-20221211.json).
Then, in the compare script just refer to yesterday date, i.e. response-20221211.json.
TSRAO
2 years agoOccasional Contributor
Thanks KarelHusa!
Not sure how to write the Groovy Script for generating the file with Date/TimeStamp in the file name, can you please suggest me!
- nmrao2 years agoChampion Level 3
Below statement can generate dyname value using date time so that it can be used for saving the filename.
print java.time.ZonedDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern("yyyyMMdd-HHmmss"))
Now, if some content needs to saved into file, below will do
def fileName = java.time.ZonedDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern("yyyyMMdd-HHmmss")) def fileContent = 'you can have your content or response into this variable' //Save the content into file; you can also add the path below if you want file to be saved in different location new File("${fileName}.json").write(fileContent)
Related Content
- 5 years ago
Recent Discussions
- 9 days ago