How to disable entire unit test in TestNG?

I believe what you want is:

@Test(enabled=false)
public class FooTest {
  //
}

(You can apply the @Test annotation to the class, as well as to methods individually.)

The TestNG documentation has a comprehensive list of the supported annotations, and also describes exclusion/inclusion of tests by group if that’s of any interest. Here’s a quote from the relevant section:

@Test Marks a class or a method as
part of the test.

…(snip)…

enabled: Whether methods on this class/method are enabled.

EDIT:
Ignoring a class by applying @Test(enabled=false) is apparently buggy functionality in some versions of TestNG according to this defect that was raised against TestNG.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)