Reputation: 75
I am using org.junit.runner.JUnitCore
class to run test from inside my java application. I have added my custom listener implementing org.junit.runner.notification.RunListener
for reporting purpose.
Currently from listener I am getting total time of all the tests by calling getRunTime()
method of org.junit.runner.Result
class. I want to get the (individual) method execution time.
Upvotes: 0
Views: 3464
Reputation: 31648
I guess your listener can get the current time when testStarted()
is called and then again get the current time when testFinished()
is called. the time difference would be the amount of time the test took to run.
Upvotes: 2