Kernel::System::UnitTest

NAME

Kernel::System::UnitTest – functions to run all or some OTRS unit tests

PUBLIC INTERFACE

Run()

run all or some tests located in scripts/test/**/*.t and print the result.

    $UnitTestObject->Run(
        Tests                  => ['JSON', 'User'],     # optional, execute certain test files only
        Directory              => 'Selenium',           # optional, execute tests in subdirectory
        Verbose                => 1,                    # optional (default 0), only show result details for all tests, not just failing
        SubmitURL              => $URL,                 # optional, send results to unit test result server
        SubmitAuth             => '0abc86125f0fd37baae' # optional authentication string for unit test result server
        SubmitResultAsExitCode => 1,                    # optional, specify if exit code should not indicate if tests were ok/not ok, but if submission was successful instead
        JobID                  => 12,                   # optional job ID for unit test submission to server
        Scenario               => 'OTRS 6 git',         # optional scenario identifier for unit test submission to server
        PostTestScripts        => ['...'],              # Script(s) to execute after a test has been run.
                                                        #  You can specify %File%, %TestOk% and %TestNotOk% as dynamic arguments.
        PreSubmitScripts       => ['...'],              # Script(s) to execute after all tests have been executed
                                                        #  and the results are about to be sent to the server.
        NumberOfTestRuns       => 10,                   # optional (default 1), number of successive runs for every single unit test
        StopOnError            => 1,                    # optional (default 0), stop test run on any test case failure.
        Chunk                  => 1,                    # optional (default 1), chunk to determine which chunk of tests should be executed
        TotalChunks            => 1,                    # optional (default 1), amount of total chunks to be executed
        RoleFilter             => '...',                # optional role filter for new test system to filter which tests should be executed
        TestTypes              => '...',                # optional test types (e.g. 'Selenium') to filter which tests should be executed
        SkipTestTypes          => '...',                # optional test types (e.g. 'Selenium') to filter which tests should *not* be executed
    );

Please note that the individual test files are not executed in the main process, but instead in separate forked child processes which are controlled by Kernel::System::UnitTest::Driver. Their results will be transmitted to the main process via a local file.

Scroll to Top