Test::Settings - Ask or tell when certain types of tests should be run
version 0.003
Check the current settings
use Test::Settings qw(:all); if (want_smoke) { printf("I must be a smoke tester\n"); } if (want_non_interactive) { ... } if (want_extended) { ... } if (want_author) { ... } if (want_release) { ... } if (want_all) { ... }
Change settings
enable_smoke; enable_non_interactive; enable_extended; enable_author; enable_release; enable_all; disable_smoke; disable_non_interactive; disable_extended; disable_author; disable_release; disable_all;
Helper - see the settings as a string
print current_settings;
Print enabled settings as ENV vars
print current_settings_env;
Print all settings as ENV vars
print current_settings_env_all;
There are a number of Environment variables used to control how tests should behave, and sometimes these can change names or meaning.
This library tries to provide a consistent interface so that testers/toolchain users can determine the state of testing without having to care about the intricacies behind the scenes.
Currently, the following methods are provided to see what the current state of testing options are. Unless explicitly requested by a user or tool, these will usually all return false.
if (want_smoke) { ... }
Returns true if we are currently being run by a smoker or a 'robot'.
if (want_non_interactive) { ... }
Returns true if we are in non-interactive mode. This means tests should not prompt the user for information.
if (want_extended) { ... }
Returns true if extended testing has been requested. Often modules will ship with extra (non author/release) tests that users may opt in to run.
if (want_author) { ... }
Returns true if author testing has been requested. Author tests are used during development time only.
if (want_release) { ... }
Returns true if release testing has been requested. Release tests are used when a new release of a distribution is going to be built to check sanity before pushing to CPAN.
if (want_all) { ... }
Returns true if all of the above wants are true.
The methods below allow modification of the state of testing. This can be used by smokers and build tools to inform testing tools how to run.
enable_smoke(); disable_smoke();
This enables or disables (default) smoke testing.
enable_non_interactive(); disable_non_interactive();
This enables or disables (default) non-interactive testing.
enable_extended(); disable_extended();
This enables or disables (default) extended testing.
enable_author(); disable_author();
This enables or disables (default) author testing.
enable_release(); disable_release();
This enables or disables (default) release testing.
Enable or disable all of the test switches at once.
If you'd like a quick representation of the current state of things, the methods below will help you inspect them.
my $str = current_settings(); print $str;
Displays a table of the current settings of all wants.
my $str = current_settings_env(); print $str;
Prints enabled settings only as ENV vars.
my $str = current_settings_env_all(); print $str
Prints ALL settings asa ENV vars.
Test::S - Change test settings on the command line
Test::DescribeMe - Tell test runners what kind of test you are
Test::Is - Skip test in a declarative way, following the Lancaster Consensus
https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md - The Annotated Lancaster Consensus
Matthew Horsfall (alh) - <wolfsage@gmail.com>
You may distribute this code under the same terms as Perl itself.
To install Test::Settings, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Settings
CPAN shell
perl -MCPAN -e shell install Test::Settings
For more information on module installation, please visit the detailed CPAN module installation guide.