mardi 31 mai 2016

junit - add timers to each @Test annotation in a Test suite (wthout replicating code)

I have a series of test classes in junit and I want to add elapsed time of only each @Test method. I want to bypass the @Before and @After, as I am not interested in the performance of those methods. I would want to start a timer before the first line of of every block of code that already exists beneath every @Test annotation, and then stop the timer on the last line of the block. I'm thinking I want to override the org.junit.Test class and insert the start and stop timers? Is there a better way to do it?

Aucun commentaire:

Enregistrer un commentaire