0

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.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
Feixiong Liu
  • 443
  • 1
  • 7
  • 14

2 Answers2

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
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: and I want to disable one test case from this package because it is failing. how should I do that? – Feixiong Liu Jun 12 '15 at 00:00
  • You can see following : http://stackoverflow.com/questions/12157846/how-to-exclude-class-in-testng – Aru Jun 12 '15 at 02:49