java - How to run maven tests in particular sequence? -



java - How to run maven tests in particular sequence? -

i've created maven project has construction following:

src/main/java src/main/resources src/test/java src/test/resources

i've kept testng tests in src/test/java folder. suppose in folder, i've 3 classes:

yahootest googletest twittertest

and each of 1 have few testng test methods.

when nail mvn clean test on command prompt, observed tests running in next order:

test googletest test twittertest test yahootest test googletest test twittertest test yahootest test googletest test twittertest test yahootest

means first classes ordered in alphabetical order i.e. googletest, twittertest, yahootest , 1 test each class executed , 1 time again 1 test each class executed. continues until test methods execution finishes.

but want customize test execution.

how can accomplish following:

arrange test execution of test classes in order want rather in alphabetical order instead of executing 1 test method each test class , 1 test method each test class ..., execute test cases same class , move test class

alphabetical how testng orders it. 1 way can utilize suite.xml can customize run way like.

the below run classes in alphabetical order 1 after other

<!doctype suite scheme "http://testng.org/testng-1.0.dtd" > <suite name="suite1" verbose="1" > <test name="check" preserve-order="true"> //this true default <packages> <package name="testngtests.mytests"></package> </packages> </test> </suite>

if want have particular order of class execution instead of specifying packages tag, utilize classes tag , set class names in order want them run.

<suite name="tmpsuite" > <test name="tmptest" > <classes> <class name="yahootest" /> <class name="googletest" /> <classes> </test> </suite>

you need specify xml in surefire plugin configuration section - refer using suitexml file section here

java maven testing testng pom.xml

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -