How To Ignore TestNG Test | TestNG Tutorial

At times we may face some situations where our code is not ready and the test cases written to test a particular method may fail. In such cases, we could use TestNG annotation @Test(enabled = false). This TestNG annotation allows us to ignore testng test.

If a test method is annotated with @Test(enabled = false), then the test case that is not ready to test is ignored.

Now, let’s see how to ignore TestNG test using a script.

Script – Test Case 1:

Script – Test Case 2: I would like to ignore this test from the test execution

testNg.xml file:

Check below video to see how to create and run testng.xml

Please be patient. The video will load in some time.

If you liked this video, then please subscribe to our YouTube Channel for more video tutorials.

Console Output:


You could find the complete TestNG tutorial here.

TestNG Complete Tutorial

If you are not regular reader of my blog then I highly recommend you to signup for the free email newsletter using the below link.

Sharing is caring.

Share on facebook
Share on twitter
Share on linkedin

Like This Post?

We have a lot more where that came from?

We only send really good stuff occasionally, promise.

Rajkumar SM

2 thoughts on “How To Ignore TestNG Test | TestNG Tutorial”

  1. Hi Raj,

    what is difference between ignoring(enable=false) the TC and skipping(throw new Skipexeption TC? Both serve same purpose rt to not to execute particular TC. In the interview if they How to skip the TC then do we need to tell both the options?

    Thank you

    1. Hi Deepa,
      ‘@Test(enabled = false)’ is used to bypass the test which is not ready to test.
      ‘throw new SkipException’ is used to throw an exception to skip some condition.

Leave a Comment

Your email address will not be published. Required fields are marked *

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on whatsapp

Recent Posts:

Scroll to Top
API Testing eBook