junit4 icon indicating copy to clipboard operation
junit4 copied to clipboard

Thread created with FailOnTimeout should be named sometime more useful than "Thread-#"

Open mkw opened this issue 11 years ago • 6 comments

When debugging or profiling highly threaded tests, leaving the JUnit timeout threads as "Thread-#" is not very useful.

The obvious name for threads would probably be the full name for the test. This could be passed in from both BlockJUnit4ClassRunner#withPotentialTimeout, which has access to the Method object, and Timeout#apply, which has access to the Description object.

The fix for #657 names these threads "Time-limited test," which somewhat more useful, but still ambiguous when a large number of tests are run.

mkw avatar Jan 10 '14 15:01 mkw

Feel free to submit a pull request that gives the threads better names. I am not sure why you would need the test name in the thread unless you are running tests in parallel, but I don't do much profiling

kcooney avatar Jan 10 '14 15:01 kcooney

I'll create a pull request as soon as I get a chance. The biggest reason that this is useful is that I sometimes use periodic memory dumps to find leaks. When looking at the dump in the profiler, the stack trace for each thread is available, but buried when many threads are active. The name of the thread is summarized in a clean list. If the thread was named with the test, it would be trivial to glance at what threads are in what states and immediately have an idea of which test or tests were running.

mkw avatar Jan 10 '14 15:01 mkw

Maybe something like this #980?

cfontes avatar Sep 02 '14 07:09 cfontes

An attempt to address this issue is being made in #1117 :point_up:

modocache avatar Apr 09 '15 00:04 modocache

The pull request originated from this issue was closed. Should this issue also be closed?

adrianosimoes avatar Feb 27 '17 23:02 adrianosimoes

@adrianosimoes the pull was closed because of unresolved comments, not because we wouldn't want this feature.

kcooney avatar Feb 28 '17 00:02 kcooney