I set the stream name in my tests. For example, see how I did it IN THIS PROJECT . Basically, all of my Log4j messages (as well as testNG reporter messages) show the thread ID in them.
Here is a basic example that makes it easy to show the stream identifier in the standard release. You can also put a stream in the html standard using the Reporter class. Unfortunately, you cannot put threadid in the test name in an HTML report unless you wrote a custom reporter (which I did in my link to my project above):
import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class ParallelMethodTest { @BeforeMethod public void beforeMethod() { long id = Thread.currentThread().getId(); System.out.println("Before test-method. Thread id is: " + id); } @Test public void testMethodsOne() { long id = Thread.currentThread().getId(); System.out.println("Simple test-method One. Thread id is: " + id); } @Test public void testMethodsTwo() { long id = Thread.currentThread().getId(); System.out.println("Simple test-method Two. Thread id is: " + id); } @AfterMethod public void afterMethod() { long id = Thread.currentThread().getId(); System.out.println("After test-method. Thread id is: " + id); } }
source share