Pieter van de Bruggen > Test-Mini > Test::Mini::Runner

Download:
Test-Mini-v1.1.3.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Source  

NAME ^

Test::Mini::Runner - Default Test Runner

DESCRIPTION ^

The Test::Mini::Runner is responsible for finding and running the appropriate tests, setting up output logging, and returning an appropriate status code. For those looking to write tests with this framework, the points of note are as follows:

METHODS ^

Attribute Accessors

exit_code
    exit_code($self) 

Exit code, representing the status of the test run.

Returns:

  • Exit code, representing the status of the test run.
filter
    filter($self) 

Test name filter.

Returns:

  • Test name filter.
logger
    logger($self) 

Logger instance.

Returns:

  • Logger instance.
seed
    seed($self) 

Randomness seed.

Returns:

  • Randomness seed.
verbose
    verbose($self) 

Logger verbosity.

Returns:

  • Logger verbosity.

Test Run Hooks

run
    run($self) 

Begins the test run. Loads and instantiates the test output logger, then dispatches to #run_test_suite (passing the #filter and #seed, as appropriate).

Returns:

run_test
    run_test($self, $tc, $test) # => Integer 

Runs a specific test.

Parameters:

  • (Class) $tc -- The test case owning the test method.
  • (String) $test -- The name of the test method to be run.

Returns:

  • (Integer) -- The number of assertions called by the test.
run_test_case
    run_test_case($self, $tc, @tests) 

Runs tests in a test case.

Parameters:

  • (Class) $tc -- The test case to run.
  • (Array<String>) @tests -- A list of tests to be run.
run_test_suite
    run_test_suite($self, %args) 

Runs the test suite. Finds subclasses of Test::Mini::TestCase, and dispatches to #run_test_case with the name of each test case and a list test methods to be run.

Parameters:

  • (Hash) %args

Valid Options for %args:

  • (String) filter -- Test name filter.
  • (String) seed -- Randomness seed.

Returns:

Callbacks

error
    error($self, $tc, $test, $e) 

Callback for dying tests.

Parameters:

  • (Class) $tc -- The test case owning the test method.
  • (String) $test -- The name of the test with an error.
  • (Test::Mini::Exception) $e -- The exception object.
fail
    fail($self, $tc, $test, $e) 

Callback for failing tests.

Parameters:

  • (Class) $tc -- The test case owning the test method.
  • (String) $test -- The name of the failed test.
  • (Test::Mini::Exception::Assert) $e -- The exception object.
pass
    pass($self, $tc, $test) 

Callback for passing tests.

Parameters:

  • (Class) $tc -- The test case owning the test method.
  • (String) $test -- The name of the passing test.
skip
    skip($self, $tc, $test, $e) 

Callback for skipped tests.

Parameters:

  • (Class) $tc -- The test case owning the test method.
  • (String) $test -- The name of the skipped test.
  • (Test::Mini::Exception::Skip) $e -- The exception object.

Class Methods

new
    new($class, %args) 

Constructor. Arguments may be provided explicitly to the constructor or implicitly via either @ARGV (parsed by Getopt::Long) or environment variables ("TEST_MINI_$option").

Parameters:

  • (Hash) %args -- Initial state for the new instance.

Valid Options for %args:

  • verbose -- Logger verbosity. Defaults to 0.
  • (String) filter -- Test name filter. Defaults to ''.
  • (Class) logger -- Logger class name. Defaults to Test::Mini::Logger::TAP.
  • (Integer) seed -- Randomness seed. Defaults to a random number < 64_000_000 .
syntax highlighting: