Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

how to find the time taken for each testcase in Rspec

$
0
0

I am using Rspec in my project where I would like to print the time taken by each testcase, Is there any way Rspec is providing any prebuilt function? I can take the starting time of the testcase by example.execution_result.started_at but I don't know how to take the end time of testcase, If I can take the end time, then I can subtract the end time from starting time to get the time duration for each testcase. Is there any one help me at this place? I have written this code

around(:each) do |example|  startTime=Time.now  var=example.run  puts var  endTime=Time.now  duration=endTime-startTime  puts "Time Taken->#{duration.to_f/60.to_f}"end

But I strongly believe Rspec must be giving some predefined method to return the duration of each testcase, do you anyone know that?


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>