Forum Discussion

MarcovS's avatar
MarcovS
Contributor
10 years ago
Solved

DataSink: Timestamp in filename

Hi all,

 

In a testcase, I have a Datasink step, where I want to save data I've collected form DataSource Step and data from executed REST Request TestStep. Every time the testcase/Datasink is executed, I want a unique outputfile to be created with a timestamp in the filename:

 

TestCase
-> DataSource
-> REST GET Request
-> Groovy Script
-> Datasink

 

I wonder if it is possible to add some variable(s) to the "Out file" field of the Datasink? Any examples how to approach this?

  • [SOLVED]

     

    Created a DataGen Step with a script-property "CurrentTimestamp" and the following code:

     

    def timestamp = new java.text.SimpleDateFormat('yyyy-MM-dd.HH.mm.ss')
    return timestamp.format(new Date()) 

    Used in the DataSink Step as output path:

     

    H:/PATH/Output/MembershipOptions_output${DataGen#CurrentTimestamp}.xlsx