Last active
August 15, 2019 10:42
-
-
Save sabesansathananthan/8b45add87826fb915a20b6abc7c2ef86 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 TestNGParallelRunner{ | |
public static void main(String[] args){ | |
if(PARALLEL_ENABLE){ | |
SeleniumGridManager seleniumGridManager = new SeleniumGridManager(); | |
seleniumGridManager.startSeleniumGrid(); | |
try{ | |
List<String>testGroup=new TestNGXmlParser().getTestGroupsFromTestNGXml(TEST_SUITE); | |
ExecutorService executoService = Executor.newFixedThreadPool(THREAD_COUNT); | |
for(String testGroup : testGroups){ | |
TestThread testThread = new TestThread(testGroup); | |
executorService.execute(testThread); | |
} | |
executorService.shutdown(); | |
while (!executorService.isTerminated()){} | |
System.out.println("Finished all threads"); | |
}catch (Exception e){ | |
LoggerUtil.logERROR{"Error in executing the test suite",e} | |
}finally{ | |
seleniumGridManager.stopSeleniumGrid(); | |
} | |
}else{ | |
LoggerUtil.logWARNING("Parallel mode is disabled. Please enable it"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment