.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Test2::Workflow 3pm" .TH Test2::Workflow 3pm "2019-05-06" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Test2::Workflow \- A test workflow is a way of structuring tests using composable units. .SH "DESCRIPTION" .IX Header "DESCRIPTION" A test workflow is a way of structuring tests using composable units. A well known example of a test workflow is \s-1RSPEC\s0 . \s-1RSPEC\s0 is implemented using Test2::Workflow in Test2::Tools::Spec along with several extensions. .SH "IMPORTANT CONCEPTS" .IX Header "IMPORTANT CONCEPTS" .SS "\s-1BUILD\s0" .IX Subsection "BUILD" Test2::Workflow::Build .PP A Build is used to compose tasks. Usually a build object is pushed to the stack before running code that adds tasks to the build. Once the build sub is complete the build is popped and returned. Usually a build is converted into a root task or task group. .SS "\s-1RUNNER\s0" .IX Subsection "RUNNER" Test2::Workflow::Runner .PP A runner takes the composed tasks and executes them in the proper order. .SS "\s-1TASK\s0" .IX Subsection "TASK" Test2::Workflow::Task .PP A task is a unit of work to accomplish. There are 2 main types of task. .PP \fI\s-1ACTION\s0\fR .IX Subsection "ACTION" .PP An action is the most simple unit used in composition. An action is essentially a name and a codeblock to run. .PP \fI\s-1GROUP\s0\fR .IX Subsection "GROUP" .PP A group is a task that is composed of other tasks. .SH "EXPORTS" .IX Header "EXPORTS" All exports are optional, you must request the ones you want. .ie n .IP "$parsed = parse_args(args => \e@args)" 4 .el .IP "\f(CW$parsed\fR = parse_args(args => \e@args)" 4 .IX Item "$parsed = parse_args(args => @args)" .PD 0 .ie n .IP "$parsed = parse_args(args => \e@args, level => $L)" 4 .el .IP "\f(CW$parsed\fR = parse_args(args => \e@args, level => \f(CW$L\fR)" 4 .IX Item "$parsed = parse_args(args => @args, level => $L)" .ie n .IP "$parsed = parse_args(args => \e@args, caller => [caller($L)])" 4 .el .IP "\f(CW$parsed\fR = parse_args(args => \e@args, caller => [caller($L)])" 4 .IX Item "$parsed = parse_args(args => @args, caller => [caller($L)])" .PD This will parse a \*(L"typical\*(R" task builders arguments. The \f(CW@args\fR array \s-1MUST\s0 contain a name (plain scalar containing text) and also a single \s-1CODE\s0 reference. The \f(CW@args\fR array \s-1MAY\s0 also contain any quantity of line numbers or hashrefs. The resulting data structure will be a single hashref with all the provided hashrefs squashed together, and the 'name', 'code', 'lines' and 'frame' keys set from other arguments. .Sp .Vb 3 \& { \& # All hashrefs from @args get squashed together: \& %squashed_input_hashref_data, \& \& # @args must have exactly 1 plaintext scalar that is not a number, it \& # is considered the name: \& name => \*(Aqname from input args\*(Aq \& \& # Integer values are treated as line numbers \& lines => [ 35, 44 ], \& \& # Exactly 1 coderef must be provided in @args: \& code => \e&some_code, \& \& # \*(Aqframe\*(Aq contains the \*(Aqcaller\*(Aq data. This may be passed in directly, \& # obtained from the \*(Aqlevel\*(Aq parameter, or automatically deduced. \& frame => [\*(AqA::Package\*(Aq, \*(Aqa_file.pm\*(Aq, 42, ...], \& } .Ve .ie n .IP "$build = init_root($pkg, %args)" 4 .el .IP "\f(CW$build\fR = init_root($pkg, \f(CW%args\fR)" 4 .IX Item "$build = init_root($pkg, %args)" This will initialize (or return the existing) a build for the specified package. \f(CW%args\fR get passed into the Test2::Workflow::Build constructor. This uses the following defaults (which can be overridden using \f(CW%args\fR): .Sp .Vb 5 \& name => $pkg, \& flat => 1, \& iso => 0, \& async => 0, \& is_root => 1, .Ve .Sp Note that \f(CW%args\fR is completely ignored if the package build has already been initialized. .ie n .IP "$build = root_build($pkg)" 4 .el .IP "\f(CW$build\fR = root_build($pkg)" 4 .IX Item "$build = root_build($pkg)" This will return the root build for the specified package. .ie n .IP "$build = \fIcurrent_build()\fR" 4 .el .IP "\f(CW$build\fR = \fIcurrent_build()\fR" 4 .IX Item "$build = current_build()" This will return the build currently at the top of the build stack (or undef). .ie n .IP "$build = build($name, \e%params, sub { ... })" 4 .el .IP "\f(CW$build\fR = build($name, \e%params, sub { ... })" 4 .IX Item "$build = build($name, %params, sub { ... })" This will push a new build object onto the build stash then run the provided codeblock. Once the codeblock has finished running the build will be popped off the stack and returned. .Sp See \f(CW\*(C`parse_args()\*(C'\fR for details about argument processing. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "Test2::Tools::Spec" 4 .IX Item "Test2::Tools::Spec" Test2::Tools::Spec is an implementation of \s-1RSPEC\s0 using this library. .SH "SOURCE" .IX Header "SOURCE" The source code repository for Test2\-Workflow can be found at \&\fIhttps://github.com/Test\-More/Test2\-Suite/\fR. .SH "MAINTAINERS" .IX Header "MAINTAINERS" .IP "Chad Granum " 4 .IX Item "Chad Granum " .SH "AUTHORS" .IX Header "AUTHORS" .PD 0 .IP "Chad Granum " 4 .IX Item "Chad Granum " .PD .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2018 Chad Granum . .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP See \fIhttp://dev.perl.org/licenses/\fR