cancel
Showing results for 
Search instead for 
Did you mean: 

is there any option to read the total project execution time through groovy

SOLVED
Highlighted
Contributor

is there any option to read the total project execution time through groovy

is there any option to read the total project execution time taken through groovy

 

I tried to by creating two properites 

Date startTime= new Date()

Very first test case and ending of test case 

Date EndTime= new Date()

setting to project level property but i unable to compare the dates since it is taking data type as string ault dddefault format is  "Sat May 18 23:54:29 IST 2019"


 

it will be very helpful if some one could answer on this?

 

I came to  alternate option as ProjectRunListener but i am not sure to how to proceed with this

 

regards,

Nagoor

2 ACCEPTED SOLUTIONS

Accepted Solutions
Occasional Contributor

Re: is there any option to read the total project execution time through groovy

 

first Testcases:

import groovy.time.*
import java.text.SimpleDateFormat

testRunner.testCase.testSuite.setPropertyValue('exeStarttime', new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss").format(new Date()))

 

 

last testCases:

 

import groovy.time.*
import java.text.SimpleDateFormat


Date exeEndtime = new Date();

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss") Date exeStarttime = dateFormat.parse(testRunner.testCase.testSuite.getPropertyValue("exeStarttime")); TimeDuration duration=TimeCategory.minus(exeEndtime, exeStarttime); log.info duration

 

Output : 10.0000 seconds.

 

Hope it will help you.

Contributor

Re: is there any option to read the total project execution time through groovy

 
 

 I am happy to accept this answer.it is working fine, just i  need to place it in tear down and set up scripts 

5 REPLIES 5
Occasional Contributor

Re: is there any option to read the total project execution time through groovy

 

first Testcases:

import groovy.time.*
import java.text.SimpleDateFormat

testRunner.testCase.testSuite.setPropertyValue('exeStarttime', new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss").format(new Date()))

 

 

last testCases:

 

import groovy.time.*
import java.text.SimpleDateFormat


Date exeEndtime = new Date();

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss") Date exeStarttime = dateFormat.parse(testRunner.testCase.testSuite.getPropertyValue("exeStarttime")); TimeDuration duration=TimeCategory.minus(exeEndtime, exeStarttime); log.info duration

 

Output : 10.0000 seconds.

 

Hope it will help you.

Frequent Contributor

Re: is there any option to read the total project execution time through groovy

The total (test) project execution time is essentially a meaningless metric from a performance testing point of view.

 

If you still want to do it, then use the groovy provided by ShasiSingh but I suggest putting it in the Setup & TearDown scripts for the Test Suite.

 

 
Contributor

Re: is there any option to read the total project execution time through groovy

exactly you are right i plan to put on set up and tear down then only it will work as expected

Contributor

Re: is there any option to read the total project execution time through groovy

 
 

 I am happy to accept this answer.it is working fine, just i  need to place it in tear down and set up scripts 

Occasional Contributor

Re: is there any option to read the total project execution time through groovy

I am more than happy to help you!

New Here?
Join us and watch the welcome video:
Top Kudoed Authors