- Plugins?
-
What are plugins?
Plugins are modules that add or alter Test2 behaviors upon loading.
Plugins do not provide assertions.
Plugins are typically global in nature.
- BailOnFail
-
Test2::Plugin::BailOnFail
This, and its brother 'DieOnFail' provide a feature that Test::Builder
was unable to provide despite significant demand.
This plugin will issue a Bail-Out event (end of testing) after the
first failed assertion.
- Bail-Out happens just before ok() would return.
- Ok() has time to print out diagnostics before the bail-out.
- Test::Builder had no way to insure diagnostics were seen, but we do!
- DieOnFail
-
Test2::Plugin::DieOnFail
This, and its brother 'BailOnFail' provide a feature that Test::Builder
was unable to provide despite significant demand.
This plugin will throw an exception after the first failed assertion.
- Exception happens just before ok() would return.
- Ok() has time to print out diagnostics before the bail-out.
- Test::Builder had no way to insure diagnostics were seen, but we do!
- ExitSummary
-
Test2::Plugin::ExitSummary
This plugin provides some useful diagnostics in some failure cases.
Example, bad plan:
- SRand
-
Test2::Plugin::SRand
Make test runs consistent, but still test random behavior.
- Sets random seed to the current date using srand("YYYYMMDD").
- Seed can be overriden with T2_RAND_SEED environment variable.
- Report the seed used in verbose mode, or when there is a test failure.
- Makes "random" behavior reproducable.
- Different days have different seeds, so you still verify changes from "random" numbers.
- UTF8
-
Test2::Plugin::UTF8
UTF8 ALL THE THINGS!!! no, really...
- Imports the utf8 pragma (on current file)
- Sets STDOUT to utf8
- Sets STDERR to utf8
- Sets the current formatter to use UTF8 on all handles
- Sets it in all formatters in the hub stack