@samatawy/rules
    Preparing search index...

    Class AbstractTestCaseAbstract

    Abstract base class for all test cases in the system, providing common properties and methods for managing test case data and state. Each specific test case type should extend this class and implement the abstract methods for handling test case logic.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    name?: string

    Optional name for the test case, which can be used for identification and debugging purposes.

    hint?: string

    An optional hint or description for the test case, which can provide additional information about its purpose or usage. This is primarily for documentation and user guidance when working with the test case.

    input: any
    expect_output: any
    expect_errors: string[]

    Methods

    • Check whether the test case is currently disabled. A disabled test case will not be evaluated or executed by the engine.

      Returns boolean

      true if the test case is disabled, false otherwise.

    • Disable the test case, preventing it from being evaluated or executed by the engine. This can be useful for temporarily turning off test cases without removing them from the system, such as during testing. Optionally, a reason can be provided for why the test case is being disabled, which will be included in the hint if no hint is already set for the test case.

      Parameters

      • Optionalreason: string

        a hint or reason for why the test case is being disabled.

      Returns void

    • Enable the test case, allowing it to be evaluated and executed by the engine if it is applicable. This can be used to re-enable a rule that was previously disabled.

      Returns void

    • What data keys are required for this test case to be applicable? This is determined by the specific implementation of the test case and should be set during the construction of the instance. The test engine uses this information to determine which test cases are applicable based on the current context.

      Returns Set<string>

      a set of data keys required for this test case to be applicable.

    • What data keys does this test case change when executed? This is determined by the specific implementation of the test case and should be set during the construction of the instance. The test engine can use this information to track which data keys are affected by the execution of the test case, which can be useful for debugging.

      Returns Set<string>

      a set of data keys changed by this test case.

    • Run the test case against the provided workspace and return the result. The specific logic for running the test case will depend on the type of test case and should be implemented in the subclasses.

      Parameters

      • workspace: Workspace

        the workspace to run the test case against, which provides the context and environment for evaluating the test case.

      Returns TestCaseResult

      the result of running the test case, including whether it passed, any output produced, and any errors encountered.