selenium - How to create and run xml file for multiple testNG classes in same package? -
how create , run .xml file multiple testng classes in same package?
i have 2 classes in same package , want run both of them 1 after another. guess can creating single .xml file. how can it?
here answer question:
lets assume have class named
class 1
follows:package q44015837_prioritize_multiclasses; import org.testng.annotations.test; public class class1 { @test void p1() { system.out.println("class1 p1"); } }
execute
class1
testng test
.- convert
class1
throughconvert testng
. testng.xml
gets generated within project space.- the
testng.xml
follows:
<suite name="suite"> <test name="test"> <classes> <class name="q44015837_prioritize_multiclasses.class1"/> </classes> </test> <!-- test --> </suite> <!-- suite -->
now lets assume have execute class named
class2
follows:package q44015837_prioritize_multiclasses; import org.testng.annotations.test; public class class2 { @test void p2() { system.out.println("class2 p2"); } }
- now, add entry of
class2
withintestng.xml
follows:
- now, add entry of
<suite name="suite"> <test name="test"> <classes> <class name="q44015837_prioritize_multiclasses.class1"/> <class name="q44015837_prioritize_multiclasses.class2"/> </classes> </test> <!-- test --> </suite> <!-- suite -->
note following have been added:
<class name="q44015837_prioritize_multiclasses.class2"/>
now execute
testng.xml
testng suite
you observe both class gets executed.
let me know if answers question.
Comments
Post a Comment