1 package test.configuration; 2 3 import org.testng.TestNG; 4 import org.testng.annotations.Test; 5 import org.testng.xml.XmlSuite; 6 7 import test.SimpleBaseTest; 8 import junit.framework.Assert; 9 10 public class BeforeClassThreadTest extends SimpleBaseTest{ 11 12 @Test beforeClassMethodsShouldRunInParallel()13 public void beforeClassMethodsShouldRunInParallel() { 14 TestNG tng = create(new Class[] { BeforeClassThreadA.class, BeforeClassThreadB.class }); 15 tng.setParallel(XmlSuite.ParallelMode.METHODS); 16 tng.run(); 17 18 Assert.assertTrue(Math.abs(BeforeClassThreadA.WHEN - BeforeClassThreadB.WHEN) < 1000); 19 } 20 } 21