I’m trying to record the start time for a test so that in the handleSummary() section I can append it to the output JSON I’m building. However, this is proving more difficult than I had thought.
I’m trying to declare a variable as so
const startTime = new Date().toLocaleTimeString();
However if this is declared in the init context, since it’s run once per VU, I just get the start time of the LAST run VU which isn’t useful. If I declare it in the setup() section the variable cannot be accessed from handleSummary()
I cant use the built in custom metrics since those are for integer based data to be stored. I considered calculating the total length of the test and subtracting that time from the my endTime variable I declare in handleSummary() but that is proving to be a more complicated solution than I had thought.
Has anyone had experience recording start times for tests in handleSummary()? Thanks