1Test::Stream::Workflow:U:sReurnnCeorn(t3r)ibuted Perl DoTceusmte:n:tSattrieoanm::Workflow::Runner(3)
2
3
4
6 Test::Stream::Workflow::Runner - Simple runner for workflows.
7
9 This distribution is deprecated in favor of Test2, Test2::Suite, and
10 Test2::Workflow.
11
12 See Test::Stream::Manual::ToTest2 for a conversion guide.
13
15 "This module is still EXPERIMENTAL". Test-Stream is now stable, but
16 this particular module is still experimental. You are still free to use
17 this module, but you have been warned that it may change in backwords
18 incompatible ways. This message will be removed from this modules POD
19 once it is considered stable.
20
22 This is a basic class for running workflows. This class is intended to
23 be subclasses for more fancy/feature rich workflows.
24
26 SUBCLASS
27 package My::Runner;
28 use strict;
29 use warnings;
30
31 use parent 'Test::Stream::Workflow::Runner';
32
33 sub instance {
34 my $class = shift;
35 return $class->new(@_);
36 }
37
38 sub subtest {
39 my $self = shift;
40 my ($unit) = @_;
41 ...
42 return $bool
43 }
44
45 sub verify_meta {
46 my $self = shift;
47 my ($unit) = @_;
48 my $meta = $unit->meta || return;
49 warn "the 'foo' meta attribute is not supported" if $meta->{foo};
50 ...
51 }
52
53 sub run_task {
54 my $self = shift;
55 my ($task) = @_;
56 ...
57 $task->run();
58 ...
59 }
60
61 USE SUBCLASS
62 use Test::Stream qw/... Spec/;
63
64 use My::Runner; # Sets the runner for the Spec plugin.
65
66 ...
67
69 CLASS METHODS
70 $class->import()
71 $class->import(@instance_args)
72 The import method checks the calling class to see if it has an
73 Test::Stream::Workflow::Meta instance, if it does then it sets the
74 runner. The runner that is set is the result of calling
75 "$class->instance(@instance_args)". The instance_args are optional.
76
77 If there is no meta instance for the calling class then import is a
78 no-op.
79
80 $bool = $class->subtests($unit)
81 This determines if the units should be run as subtest or flat. The
82 base class always returns true for this. This is a hook that allows
83 you to override the default behavior.
84
85 $runner = $class->instance()
86 $runner = $class->instance(@args)
87 This is a hook allowing you to construct an instance of your
88 runner. The base class simply returns the class name as it does not
89 need to be instansiated. If your runner needs to maintain state
90 then this can return a blessed instance.
91
92 CLASS AND/OR OBJECT METHODS
93 These are made to work on the class itself, but should also work just
94 fine on a blessed instance if your subclass needs to be instantiated.
95
96 $runner->verify_meta($unit)
97 This method reads the "$unit->meta" hash and warns about any
98 unrecognised keys. Your subclass should override this if it wants
99 to add support for any meta-keys.
100
101 $runner->run(unit => $unit, args => $arg)
102 $runner->run(unit => $unit, args => $arg, no_final => $bool)
103 Tell the runner to run a unit with the specified args. The args are
104 optional. The "no_final" arg is optional, it should be used on
105 support units that should not produce final results (or be a
106 subtest of their own).
107
108 $runner->run_task($task)
109 This simply calls "$task->run()". It is mainly here for subclasses
110 to override.
111
113 The source code repository for Test::Stream can be found at
114 http://github.com/Test-More/Test-Stream/.
115
117 Chad Granum <exodist@cpan.org>
118
120 Chad Granum <exodist@cpan.org>
121
123 Copyright 2015 Chad Granum <exodist7@gmail.com>.
124
125 This program is free software; you can redistribute it and/or modify it
126 under the same terms as Perl itself.
127
128 See http://dev.perl.org/licenses/
129
130
131
132perl v5.30.0 2019-07-26 Test::Stream::Workflow::Runner(3)