I have a test cast package setup to run. However, there are some test cases in the package I want to exclude. How should I do it if I do not change the code? as far as I know testng does not have feature that to exclude single test case inside the package.
Asked
Active
Viewed 1,634 times
2 Answers
1
As you are using TestNg, the easiest option is adding (enabled = false) after the @Test annotation.
@Test(enabled = false)
public void yourTestMethod() throws Exception {
//your code here
}
See here for information on annotations.

Shadowheim
- 56
- 4
-
what if I do not change the code, how can accomplish that changing testng.xml? – Feixiong Liu Jun 12 '15 at 22:20
0
You can exclude methods and groups in TestNG,see [here.][1]
[1]: http://testng.org/doc/documentation-main.html#testng-xml
I am able to exclude method using following code :
<classes>
<class name="scripts.CheckTest" />
<class name="scripts.Day1" >
<methods>
<exclude name="verifyMobilePageTitle" />
</methods>
</class>
</classes>

Aru
- 134
- 4
-
Hi i am not running the classes but the package. for example:
-
You can see following : http://stackoverflow.com/questions/12157846/how-to-exclude-class-in-testng – Aru Jun 12 '15 at 02:49