Why Ignore Tests

While developing unit tests, there may be a case where a particular test is not relevant at the moment, but will be in the future. For example, a developer may run a number of tests successfully, however a few may fail because a specific feature is not scheduled to be completed until the next release. In this cases it may be natural to simply comment out the failing tests, this, however, may lead to problems down the road. When it comes time to implement the missing piece of functionality, there is no way to tell exactly how many tests have been commented out from the test case. The [Ignore] [Metadata] will prevent this issue from occurring. Unlike commenting out a test, the tests decorated with the [Ignore] tag will still appear in the output reminding you to fix and/or complete these methods.

Ignoring Tests

When ignoring a test, the test will still be built, but will be skipped over when running all tests in the [TestCase]. The test will still be counted in the total tests count. To ignore a test, simply apply the [Ignore] [Metadata] tag to the the test that will be ignored.

package flexUnitTests
{
     public class MyIgnoreTest
     {         
          [Test( description = "This test is not being ignored" )]
          public function myTestA():void{
               // test assertions  
          }
          [Ignore]
          [Test( description = "This test is being ignored" )]
          public function myTestB():void{
               // test assertions  
          }
          
     }
}
  • No labels