java - Partitioning tests across multiple nodes with Gradle and TestNG -


i have java project lot of tests. build using gradle , tests using testng , invoked gradle. speed testing build running build simultaneously on multiple workers , having each worker run subset of tests.

each node provide 2 environment variables total_nodes , node_number, total_nodes number of nodes running build , node_number number assigned particular node.

i want way of partitioning tests each node runs ~ 1/total_nodes tests , each test run once. there simple way of doing gradle , testng?

i manually divide tests groups labeling each 1 in specific group, there many tests , that's major maintenance hassle, plus doesn't scale if number of nodes change.

gradle offers tests filtering, seems it's based on class name matching, , can't accept arbitrary filtering functions. find test files , subdivide them according hashing scheme before plugging them test filter, seems needlessly complex.

is there simpler way of doing this?

there no simple way provided gradle or testng, can implement listener org.testng.imethodinterceptor , in implement algorithm splitting.

org.testng.imethodinterceptor#intercept called before test suite starts , test instances scheduled run. if read env variables , spit instances categories based on total_nodes can return category matches node_number e.g. using hashmap key node_number , value list<imethodinstance> @ end intercept() returns map.get(node_number)

http://testng.org/doc/documentation-main.html#methodinterceptors


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -