Skip to content

Ignoring Tests

James Richford edited this page Jan 6, 2017 · 2 revisions

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

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

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

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

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

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

@IgnoreTests()
@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, IgnoreTest, TestFixture } from "alsatian";

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

  @Test()
  @IgnoreTest("This test is useless, ignore for now.")
  public ignoredTest() {
    Expect(1).toBe(1);
  }
}
Clone this wiki locally