Skipping a Test case in TestNG

August 21, 2016

To skip a test case an attribute all enabled is used. It is a boolean attribute where:

True – Testcase will be executed.

False – Testcase will not be executed.

By Default, the value of this attribute is true.

Let us consider below example which has 4 test cases, we are passing enabled = false in testcase2 method.

Here, in above code, as testcase2 method is disabled. So it will not be executed and output will be:

Test case 3
Test case 1
Test case 4

PS: For any questions queries or comment feel free to write us at saurabh@qatechhub.com or support@qatechhub.com. Happy Learning 🙂

Saurabh

About the Author

Saurabh

Follow Saurabh:

Leave a Comment: