NAME
Test::Class::Moose::CLI - Use this in your tcm.t script for a drop-in runner tool
VERSION
version 0.99
SYNOPSIS
# In a t/tcm.t file ...
use Test::Class::Moose::CLI;
Test::Class::Moose::CLI->new_with_options->run;
# From the command line ...
$> prove -lv t/tcm.t :: --classes TestFor::Foo --classes TestFor::Bar --tags quick --tags db --jobs 8
DESCRIPTION
This class provides support for passing various Test::Class::Moose::Config options via the command line.
It is entirely implemented by the Test::Class::Moose::Role::CLI role, which you can use in your own class to provide your own custom test runner.
COMMAND LINE OPTIONS
This class allows you to pass the following command-line options:
--classes
This should be the full name of one a class that you want to run (rather than running classes).
You can also pass a path to a single class. Any leading t/lib/
part of the path will be stripped, and the rest will be transformed from a path to a module name.
Finally, you can pass a path to a directory. It will be searched for .pm files and each of those files will be loaded as a test class.
You can pass this option more than once.
--methods
The name of a method that you want to run. You can pass this option more than once.
This will actually be turned into a regex like qr/^(?:foo|bar)$/
. It will be matched against all classes that are being run.
--exclude-methods
The name of a method that you do not want to run. You can pass this option more than once. This is turned into a regex just like --methods
.
--tags
The name of one or more test method tags that you want to include. Only test method matching these tags will be run.
--exclude-tags
The name of one or more test method tags that you want to exclude. Any test methods matching these tags will be ignored.
--parallel-progress and --no-parallel-progress
Show a progress indicator when running tests in parallel. Defaults to true.
--color and --no-color
Enable/disable color for the parallel progress output. Defaults to true.
--jobs
The number of jobs to run. Defaults to 1.
--randomize-methods
If true, methods for each class will be run in a random order. Defaults to false.
--randomize-classes
If true, classes will be run in a random order. Defaults to false.
--set-process-name
If true, the process name ($0
) will be updated to include the name of each test class as the class is being run.
--statistics
If true, this will output some extra statistics info as diagnostic output at the end of the run. Defaults to false unless --use-environment
is true and the HARNESS_IS_VERBOSE
environment variable is also true.
--show-timing
If true, this will output some extra timing info as diagnostic output at the end of the run. Defaults to false unless --use-environment
is true and the HARNESS_IS_VERBOSE
environment variable is also true.
--runner-class
The name of the runner class to use. Defaults to Test::Class::Moose::Runner. This class will be loaded when creating the runner if it is not already loaded.
--test-lib-dirs
This should be the path to a directory containing test classes. The path can be relative to the project root (t/lib) or absolute. If you do not pass this argument it will default to t/lib.
You can pass this option more than once if you'd like to include multiple test directories.
--timing-data-file
If this is passed, the value returned by Test::Class::Moose::Report->timing_data
plus some other information will be encoded as JSON and stored in this file. The exact data stored looks like:
{
process_name => $0,
start_time => $epoch_time
timing => \%timing_data_from_report,
}
LOADING TEST CLASSES
If you pass classes with the --classes
option, only these classes will be loaded. Otherwise all classes under t/lib will be loaded.
SUPPORT
Bugs may be submitted at https://github.com/houseabsolute/test-class-moose/issues.
I am also usually active on IRC as 'autarch' on irc://irc.perl.org
.
SOURCE
The source code repository for Test-Class-Moose can be found at https://github.com/houseabsolute/test-class-moose.
AUTHORS
Curtis "Ovid" Poe <ovid@cpan.org>
Dave Rolsky <autarch@urth.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 - 2021 by Curtis "Ovid" Poe.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
The full text of the license can be found in the LICENSE file included with this distribution.