xml - Running test inside testng suite in specific order -
i want run tests inside testng in specific order. possible?
for example here testng.xml file. want run chrome test first , firefox. dont want them run parallel. how that?
<?xml version="1.0" encoding="utf-8"?> <!doctype suite system "http://testng.org/testng-1.0.dtd"> <suite name="mycompany.myapp.local" parallel="none"> <test name="test module in chrome"> <parameter name="selenium.browser" value="chrome" /> <parameter name="wheretorun" value="local" /> <parameter name="chrome.driver.path" value="/path/to/chromedriver" /> <classes> <class name="com.mycompany.testclass"> <methods> <include name="navigatetouserpage" /> <include name="createuser" /> <include name="verifysomething1" /> <include name="verifysomething2" /> <include name="logout" /> </methods> </class> </classes> </test> <test name="test module in firefox"> <parameter name="selenium.browser" value="firefox" /> <parameter name="wheretorun" value="local" /> <classes> <class name="com.mycompany.testclass"> <methods> <include name="loginwithcreateduser" /> <include name="verifysomething1" /> <include name="verifysomething2" /> <include name="logout" /> </methods> </class> </classes> </test> </suite>
i trying achieve this: - create user in 1 test , use same user in tests. want run first test , run second after first 1 finished.
otherwise, there option run @ suite level .. create user , set data , run these 2 test?
many in advance taking out time me.
before give answer, want should strive run things in parallel. in long run. if means logging in , out multiple times or creating pool of test users used on , over. tests should short, should test 1 thing , not dependent on other tests.
but since ideal isn't possible.
"preserve-order if true, classes in tag run in same order found in xml file."
<?xml version="1.0" encoding="utf-8"?> <!doctype suite system "http://testng.org/testng-1.0.dtd"> <suite name="mycompany.myapp.local" parallel="tests" thread-count="1" preserve-order="true"> <test name="setup user" preserve-order="true"> <parameter name="selenium.browser" value="chrome" /> <parameter name="wheretorun" value="local" /> <parameter name="chrome.driver.path" value="/path/to/chromedriver" /> <classes> <class name="com.mycompany.testclass"> <methods> <include name="createuser" /> </methods> </class> </classes> </test> <test name="test module in chrome" preserve-order="true"> <parameter name="selenium.browser" value="chrome" /> <parameter name="wheretorun" value="local" /> <parameter name="chrome.driver.path" value="/path/to/chromedriver" /> <classes> <class name="com.mycompany.testclass"> <methods> <include name="loginwithcreateduser" /> <include name="verifysomething1" /> <include name="verifysomething2" /> <include name="logout" /> </methods> </class> </classes> </test> <test name="test module in firefox" preserve-order="true"> <parameter name="selenium.browser" value="firefox" /> <parameter name="wheretorun" value="local" /> <classes> <class name="com.mycompany.testclass"> <methods> <include name="loginwithcreateduser" /> <include name="verifysomething1" /> <include name="verifysomething2" /> <include name="logout" /> </methods> </class> </classes> </test> </suite>
you can set "priority" on each test insure runs in right order.
again maybe better set 4 static users, run 4 verifysomething tests , create user test in parallel.
Comments
Post a Comment