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.

Ignore testng test

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

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

    • 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

Share via
Copy link
Powered by Social Snap