EADS_Support
15 years agoOccasional Contributor
Datasink property not getting set correctly with Grvy Script
Hi
I have two groovy script steps within my test case to output a start and end time to properties within a data sink set within a data source loop (note the set time scripts both sit outside of the loop)
when the test runner goes through the output log returns the values as you would expect,
i.e.
09:01:51,601 INFO [log] StartT: =09:01:51
09:04:42,836 INFO [log] EndT: =09:04:42
however when looking into the datasink output only the start time is evident and no end time value exists
StartTime script:-
End Time script:-
I have two groovy script steps within my test case to output a start and end time to properties within a data sink set within a data source loop (note the set time scripts both sit outside of the loop)
when the test runner goes through the output log returns the values as you would expect,
i.e.
09:01:51,601 INFO [log] StartT: =09:01:51
09:04:42,836 INFO [log] EndT: =09:04:42
however when looking into the datasink output only the start time is evident and no end time value exists

StartTime script:-
Starttime = new Date();
timeformat = new java.text.SimpleDateFormat('hh:mm:ss');
Starttimefmtd = timeformat.format(Starttime);
def dataSink = testRunner.testCase.testSteps['DataSink'];
dataSink.setPropertyValue('StartTime', Starttimefmtd);
dataSink.setPropertyValue('EndTime', "");
log.info ("StartT: ="+Starttimefmtd);
End Time script:-
Endtime = new Date();
timeformat = new java.text.SimpleDateFormat('hh:mm:ss');
Endtimefmtd = timeformat.format(Endtime);
def dataSink = testRunner.testCase.testSteps['DataSink'];
dataSink.setPropertyValue('EndTime', Endtimefmtd);
log.info ("EndT: ="+Endtimefmtd);