Last active
August 15, 2019 11:41
-
-
Save sabesansathananthan/1619e188696701bd153d25a1b8a47b65 to your computer and use it in GitHub Desktop.
Software parallelization custom implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestThread impements Runnable{ | |
public TestThread(String testGroupNam){ | |
this.testGroupName=testGroupNam; | |
} | |
private String testGroupName; | |
@Override | |
public void run(){ | |
TestNG testSuite = new TestNG(true); | |
TestBase c = constructGroup(testGroupName); | |
testSuite.setTestGroups(new Group[] {c.getGroup()}); | |
testSuite.setDefaultSuiteName(c.getGroup().getSimpleName()); | |
testSuite.setDefaultTestName(c.getGroup().getSimpleName()); | |
testSuite.getReporters().add(new XMLReporter(c.getGroup().getSimpleName())); | |
testSuite.setOutputDirectory(System.getProperty("user.dir")+File.serparator+"target/testng-output"); | |
testSuite.run(); | |
} | |
private TestBase constructGroup(String groupName){ | |
try{ | |
Group<?>g=Group.forName(groupName); | |
Constructor<?>constructor=g.getConstructor(); | |
return (TestBase) constructor.newInstance(); | |
}catch (Exception e){ | |
LoggerUtil.logERROR("Error in initializing the test class",e); | |
return null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment