rajareddytester
14 years agoOccasional Contributor
How to Log the "Start Time" and "Time Taken" for a test step
Hi,
Good Morning!
Can somebody suggest me how to log the "StartTime" and "TimeTaken" for a test step using groovy script.
FYI I am using the below code to fetch the rest of details,
================
def filePath = context.expand('${#Project#FilePath}');
def requestId = context.expand('${#TestCase#RequestId}');
def serviceName = context.getTestCase().name;
def statusCode = context.expand('${#Response#//*:envelope[1]/*:body[1]/*:Status/*:StatusCode}');
def statusDesc = context.expand('${#Response#//*:envelope[1]/*:body[1]/*:Status/*:StatusDesc}');
def status = context.expand('${#TestCase#Flag}');
File foutput = new File(filePath);
if (!foutput.exists()){
String line = "RequestId\t" + "ServiceName\t" + "StatusCode\t" + "StatusDesc\t" + "Status\t";
foutput.write(line+"\n");
}
String line = "$requestId\t" + "$serviceName\t" + "$statusCode\t" + "$statusDesc\t" + "$status\t";
foutput.append(line+"\n");
Thanks,
Raja
Good Morning!
Can somebody suggest me how to log the "StartTime" and "TimeTaken" for a test step using groovy script.
FYI I am using the below code to fetch the rest of details,
================
def filePath = context.expand('${#Project#FilePath}');
def requestId = context.expand('${#TestCase#RequestId}');
def serviceName = context.getTestCase().name;
def statusCode = context.expand('${#Response#//*:envelope[1]/*:body[1]/*:Status/*:StatusCode}');
def statusDesc = context.expand('${#Response#//*:envelope[1]/*:body[1]/*:Status/*:StatusDesc}');
def status = context.expand('${#TestCase#Flag}');
File foutput = new File(filePath);
if (!foutput.exists()){
String line = "RequestId\t" + "ServiceName\t" + "StatusCode\t" + "StatusDesc\t" + "Status\t";
foutput.write(line+"\n");
}
String line = "$requestId\t" + "$serviceName\t" + "$statusCode\t" + "$statusDesc\t" + "$status\t";
foutput.append(line+"\n");
Thanks,
Raja