Kernel::Test::Role::IsTestCase::Sequential

NAME

Kernel::Test::Role::IsTestCase::Sequential – role for endpoint tests

PUBLIC INTERFACE

has 'TestSteps'

Attribute that holds the sequential test cases, which will be provided with the builder. The builder (Tests) needs to be defined in the single test file like described.

requires BuildTestSteps()

The usage of the role requires a BuildTestSteps function which provides a list of test cases with the following structure:

    return (
        {
            Name                    => 'Example test case name',
            PreTestStepFunction     => sub {},                   # optional, will receive $Self as first argument
            PreTestStepFunction     => {                         # optional
                Name => 'FunctionName'
                Params => {},
            },
            PostTestStepFunction => sub {},                      # optional, will receive $Self as first argument
            PostTestStepFunction => {                            # optional
                Name => 'FunctionName'
                Params => {},
            },
            Data           => {},
            ExpectedResult => {},
        },
    );

Every test case should provide a Name and when possible a Data and ExpectedResult key. It's also possible to provide a function (PreTestStepFunction) which will be executed before the test case. You can directly define a function or a name from a function in the test file (and some params for the function). Same goes for PostTestStepFunction which can be used for a cleanup between the two test steps.

requires RunTestStep()

The usage of the role requires a RunTestStep function in the test file. In the function the execution of a single test case needs to be defined. The function gets the complete test case data.

Run()

In a sequential test the run will be automatically executed for the defined test cases. It's possible to define a pre test case function which will be executed before a test case.

Scroll to Top