import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class BeforeMethodTestMethodThreadId {
@BeforeMethod
public void beforeMethod() {
printer("beforeMethod");
}
@Test
public void testMethod() {
printer("testMethod");
}
@Test
public void anotherTestMethod() {
printer("anotherTestMethod");
}
@AfterMethod
public void afterMethod() {
printer("afterMethod");
}
private void printer(String methodName) {
String msg = String.format("%s() is running on Thread id [%d]", methodName, Thread.currentThread().getId());
System.err.println("[DEBUGGER] :" + msg);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Class1Suite" parallel="methods" verbose="2">
<test name="Class1Test">
<classes>
<class name="organized.chaos.forums.BeforeMethodTestMethodThreadId"/>
</classes>
</test> <!-- Class1Test -->
</suite> <!-- Class1Suite -->
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
What happens when you tried doing it?
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/
Reply-To: <testng...@googlegroups.com>
Date: Friday, April 6, 2018 at 3:32 AM
To: testng-users <testng...@googlegroups.com>
Subject: [testng-users] Re: @Test and @BeforeMethod/@AfterMethod run in different thread?
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.