title: What is the best practice to skip a test in TestNG?
body: <p>I started using TestNG just a few months ago. I want to skip a @Test that has a bug associated waiting to be fixed, without ignoring it (that is, without marking it as enabled=false) as I still want it to appear in the report as a skipped.</p>
  
  <p>I also have dependencies to that test, so if I just ignore the @Test, then I will have to change all the dependencies. I prefer skipping the test, so the depending tests would just be skipped as well.</p>
  
  <p>I'm currently trying to do:</p>
  
  <pre><code>@Test(enabled = true, groups = { "GroupA" }, dependsOnMethods = { "MethodB" } )
  public void testA() {
  
     throw new SkipException("Test blocked due to Bug-1234");
  
     doTest(); // Compile error: Unreachable code.
  }
  </code></pre>
  
  <p>A quick solution would be to comment that code, but that would generate a lot of warnings, and wouldn't look good.</p>
  
  <p>I could also add an if(true) before the Skip, as I saw in other solutions, but that generates a dead code warning that I would prefer to avoid.</p>
  
  <p>Rather than "what can I do?", my question would be "what would you do?". Is there a common practice to deal with this with TestNG?</p>
  
  <p><em>(This is my very first post, please forgive me if I failed to find an already existing answer to this).</em></p>