The name of the entire group of tests.
What this group tests.
pre_test_cleanup (optional, default=1)
If this is true (the default), the component root and data directory will be deleted both before and after running tests.
Takes the following parameters:
o path (required)
The path that other components will expect this component to be reachable at. All paths are prepended with the group name. So /bar as a support component in the foo groups ultimate path would be /foo/bar.
Text of the support component. This parameter must have a value unless the skip_component parameter is true.
If true, then the test harness will not write a component to disk for this test.
Takes the following parameters:
One of the following three options is required:
o name (required)
The name of this test.
o description (required)
What this test is testing.
o component (required)
Text of the component.
o path (optional)
The path that this component should written to. As with support components, this path is prepended with the groups name. If no path is given, it uses call_path, if given, otherwise it uses the name parameter.
o call_path (optional)
The path that should be used to call the component. If none is given, it will be /<group name>/<test name>. If a value is given, it is still prepended by /<group name>/.
o call_args (optional)
The arguments that should be passed to the component, in list or hash reference form. If none is given, no arguments are passed.
This is a hash reference of parameters to be passed to the Compiler->new method.
This is a hash reference of parameters to be passed to the Interp->new method.
Provide an HTML::Mason::Interp object to be used for the test.
If this is given, the test will be treated as a todo test, so it will be expected to fail. This should be a string.
The text expected as a result of calling the component. This parameter is _not_ required when running in Create mode.
A regex that will be matched against the error returned from the component execution.
o no_warnings o expect_warnings
A regex that will be matched against any warnings output when running the component.
This causes the component to be run but its output is ignored. However, if the component execution causes an error this will cause the test to fail. This is used in a few situations where it is necessary to just run a component as part the preparation for another test.
Run the tests in the group.
These methods are provided since some tests may need to know these values.
The base path under which the component root and data directory for the tests are created.
Returns the component root directory.
Return the data directory
check_output ( actual => CW$actual_output, expect => CW$expected_output )Given the parameters shown above, this method will check to see if the two are equal. If theyre not equal, it will print out an error message attempting to highlight the difference.
The following additional modes are available for running tests.
To turn this on, set the environment variables MASON_VERBOSE or MASON_DEBUG as true or run the tests as make test TEST_VERBOSE=1. In this mode, the run method will output information about tests as they are run. If a test fails, then it will also show the cause of the failure.
To turn this on, set the MASON_DEBUG environment variable to a true value. In this mode, the run method will print detailed information of its actions. This mode includes the output printed in VERBOSE mode.
Setting the MASON_NO_CLEANUP environment variable will tell the module to not clean up generated data from running the tests. This includes the components written to disk and the data directory used during testing. This can be useful when debugging.
If the individual tests are run from the command line with the --create flag, then instead of checking the output of a component, the test harness will simply output its results. This allows you to cut and paste these results back into the test file (assuming they are correct!).
You can run just some of a test file with the --tests-to-run flag or the MASON_TESTS_TO_RUN environment variable. Similarly you can skip specific tests with the --tests-to-skip flag or the MASON_TESTS_TO_SKIP environment variable.
The value of either flag is a comma-separated list of one or more of
You can run tests with your own Tests.pm subclass using the --tests-class flag or the MASON_TESTS_CLASS environment variable. The value is a fully qualified package name that will be loaded before each test file is run. e.g.
For example, if you have created your own lexer subclass and want to make sure that tests still pass with it, create a Tests subclass that overrides the _make_interp method to use your subclass:
|perl v5.20.3||HTML::MASON::TESTS (3)||2014-11-15|