Skip to content

Ignoring Tests

James Adarich edited this page Aug 1, 2019 · 2 revisions

You can stop tests from being run by using the Ignore annotation

import { Expect, Test, Ignore, TestFixture } from "alsatian";

@TestFixture("Example Test Fixture")
export class ExampleTestFixture {

  @Test()
  @Ignore()
  public ignoredTest() {
    Expect(1).toBe(1);
  }
}

or you can stop all tests in a given fixture from running using the Ignore annotation

import { Expect, Test, Ignore, TestFixture } from "alsatian";

@Ignore()
@TestFixture("Example Test Fixture")
export class ExampleTestFixture {

  @Test()
  public thisTestWillNotBeRun() {
    Expect(1).toBe(1);
  }

  @Test()
  public neitherWillThisOne() {
   Expect(1).toBe(1);
  }
}

You can provide a reason to both of these, which will put it into the TAP output.

import { Expect, Test, Ignore, TestFixture } from "alsatian";

@TestFixture("Example Test Fixture")
export class ExampleTestFixture {

  @Test("Ignored Test")
  @Ignore("This test is useless, ignore for now.")
  public ignoredTest() {
    Expect(1).toBe(1);
  }
}