TestNG - Ignoring the Test

When executing TestNG tests, there may be some scenarios where you may have to disable a particular test or a set of tests from getting executed. For example, consider a scenario where a serious bug exists in a feature due to certain tests belonging to certain scenarios that cannot be executed. As the issue has already been identified we may need to disable the said test scenarios from being executed.
Disabling a test in TestNG can be achieved by setting the enable attribute of the @Test annotation to false. This will disable the said test method from being executed as part of the test suite. If this attribute is set for the Test annotation at class level, all the public methods inside the class will be disabled.
@Test( enabled=false )




Output :

Amm in Test method one and set to TRUE.
Am in Test method three - Will execute by default
PASSED: testMethodOne
PASSED: testMethodThree





No comments:

Post a Comment

Note: Only a member of this blog may post a comment.