'How to exclude class in TestNG [duplicate]
I have a test suite called Test.XML. If I want to exclude any one class, how can I do that?
Here is the Test.XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="TestAll">
<test name="test1">
<classes>
<class name="test.LoginOneReports" />
</classes>
</test>
<test name="test2">
<classes>
<class name="test.OEPR_DefaultTab" />
</classes>
</test>
<test name="test3">
<classes>
<class name="test.OEPR_InternalvsExternalTab" />
</classes>
</test>
</suite>
Solution 1:[1]
You can't explicitly exclude classes in TestNG.xml. Please refer to more detailed answer for question How to exclude class in TestNG.
Solution 2:[2]
Mention all the class names inside <classes> including the ones that should not be run. And, inside the class that should be excluded, use and <exclude name =.* />. It will exclude all the tests from this class and run all the other classes.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Community |
Solution 2 | Juscelino Alves de Carvalho |