| Test2::Harness::Plugin(3pm) | User Contributed Perl Documentation | Test2::Harness::Plugin(3pm) |
Test2::Harness::Plugin - Base class for Test2::Harness plugins.
This class holds the methods specific to Test2::Harness which is the backend. Most of the time you actually want to subclass App::Yath::Plugin which subclasses this class, and holds additional methods that apply to yath (the UI layer).
You probably want to subclass App::Yath::Plugin instead. This class here mainly exists to separate concerns, but is not something you should use directly.
package Test2::Harness::Plugin::MyPlugin;
use parent 'Test2::Harness::Plugin';
# ... Define methods
1;
$default_search is an arrayref with the default files/directories pulled in when nothing is specified at the command ine.
$settings is an instance of Test2::Harness::Settings
Example duration data:
{
't/foo.t' => 'medium',
't/bar.t' => 'short',
't/baz.t' => 'long',
}
Examples:
[
'foo.t',
'bar.t',
'baz.t',
]
{
'lib/Foo.pm' => [
't/foo.t',
't/integration.t',
],
'lib/Bar.pm' => [
't/bar.t',
't/integration.t',
],
}
Plugins may implement this without implementing coverage_data(), making this useful if you want to use a pre-existing coverage module and want to do post-processing on what it provides.
sub inject_run_data {
my $class = shift;
my %params = @_;
my $meta = $params{meta};
my $fields = $params{fields};
# Meta-data is a hash, each plugin should define its own key, and put
# data under that key
$meta->{MyPlugin}->{stuff} = "Stuff!";
# Fields is an array of fields that a UI might want to display when showing the run.
push @$fields => {name => 'MyPlugin', details => "Human Friendly Stuff", raw => "Less human friendly stuff", data => $all_the_stuff};
return;
}
Note that data from all changed_files() calls from all plugins will be merged.
Diffs must be in the same format as this git command:
git diff -U1000000 -W --minimal BASE_BRANCH_OR_COMMIT
Some other diff formats may work by chance, but they are not dirfectly supported. In the future other diff formats may be directly supported, but not yet.
The following return sets are allowed:
This is particularily useful in "setup()" and "teardown()" when running external commands, specially any that daemonize and continue to produce output after the setup/teardown method has completed.
$name is required because it will be used for filenames, and will be used as the output tag (best to limit it to 8 characters).
This will redirect STDERR and STDOUT to files that will be picked up by the yath collector so that any output appears as proper yath events and will be included in the yath log.
$name is required because it will be used for filenames, and will be used as the output tag (best to limit it to 8 characters).
The source code repository for Test2-Harness can be found at http://github.com/Test-More/Test2-Harness/.
Copyright 2020 Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
| 2023-10-04 | perl v5.36.0 |