I have some component tests that are running relatively slow (a few seconds each) and am trying to figure out which functions are eating the most time. Is there a way I can have that displayed to me in eclipse when I run a JUnit test, maybe similar to the coverage data?
I have already tried using VisualVM for that, but the problem I have there is that the test process is only available while the test is running, so the best I can do there is put a breakpoint right at the beginning of the test, then debug the test, attach the VisualVM profiler, and the unpause the test, which sadly means that whatever few seconds I need to unpause the test bloats up the statistic.
It feels like there should be some way to say "start test and profile method execution time", but I have been looking at a few different options now (such as the Java Monitor plugin for eclipse) but none of them seems to offer that option?
Is there a way to do that? Or is it really the best solution to pause each test and then manually attach a profiler?
And maybe related to this, if I have a test case suite, how do I attach the profiler before any tests are run?