RSX Code Reference
    Preparing search index...

    Class TestSuiteAbstract

    Primary class for unit testing. Override and register unit tests in the constructor, then run the tests using the desired method of output.

    class MyTestSuite extends TestSuite
    {
    constructor()
    {
    super();
    this.addTest(() => this.testSomething(), "MyTestSuite.testSomething");
    }

    private testSomething(): void
    {
    this.assert(1 + 1 === 2, "Basic math should work");
    }
    }
    Index
    • Adds a new child suite to this suite. This method allows you to group suites and execute them all at once.

      Parameters

      Returns void

    • Register a new unit test.

      Parameters

      • test: () => void

        Function to call in order to execute the test.

      • name: string

        Name of the test we can use for referencing it later.

      Returns void

    • Tests if condition is true, and reports unit test failure if it fails.

      Parameters

      • condition: boolean

        The condition to test.

      • Optionalexpression: string

        Optional string representation of the expression being tested.

      Returns void

    • Reports success or failure depending on the result of an expression.

      Parameters

      • success: boolean

        If true, success is reported; otherwise, failure.

      • description: string

        Message describing the nature of the failure.

      Returns void

    • Tests if condition is true, and reports unit test failure with a message if it fails.

      Parameters

      • condition: boolean

        The condition to test.

      • message: string

        The message to display on failure.

      Returns void

    • Fetches the number of failed tests after running the suite.

      Returns number

      The number of failed tests.

    • Fetches the list of failed tests after running the suite.

      Returns FailedTestEntry[]

      An array of failed test entries.

    • Runs all the tests in the suite (and sub-suites). Test results are reported to the provided output class.

      Parameters

      • output: TestOutput

        The output handler for test results.

      Returns void

    • Called after all tests and child suite's tests are run. Override this method to perform cleanup after tests.

      Returns void

    • Called right before any tests are run. Override this method to perform setup before tests.

      Returns void