1App::Cmd::Tester::CaptuUrseeErxtCeornntarli(b3u)ted PerlApDpo:c:uCmmedn:t:aTteisotner::CaptureExternal(3)
2
3
4
6 App::Cmd::Tester::CaptureExternal - Extends App::Cmd::Tester to capture
7 from external subprograms
8
10 version 0.334
11
13 use Test::More tests => 4;
14 use App::Cmd::Tester::CaptureExternal;
15
16 use YourApp;
17
18 my $result = test_app(YourApp => [ qw(command --opt value) ]);
19
20 like($result->stdout, qr/expected output/, 'printed what we expected');
21
22 is($result->stderr, '', 'nothing sent to sderr');
23
24 ok($result->output, "STDOUT concatenated with STDERR");
25
27 App::Cmd::Tester provides a useful scaffold for testing applications,
28 but it is unable to capture output generated from any external
29 subprograms that are invoked from the application.
30
31 This subclass uses an alternate mechanism for capturing output
32 (Capture::Tiny) that does capture from external programs, with one
33 major limitation.
34
35 It is not possible to capture externally from both STDOUT and STDERR
36 while also having appropriately interleaved combined output.
37 Therefore, the "output" from this subclass simply concatenates the two.
38
39 You can still use "output" for testing if there is any output at all or
40 for testing if something appeared in either output stream, but you
41 can't rely on the ordering being correct between lines to STDOUT and
42 lines to STDERR.
43
45 This module has a long-term perl support period. That means it will
46 not require a version of perl released fewer than five years ago.
47
48 Although it may work on older versions of perl, no guarantee is made
49 that the minimum required version will not be increased. The version
50 may be increased for any reason, and there is no promise that patches
51 will be accepted to lower the minimum required perl.
52
54 Ricardo Signes <rjbs@semiotic.systems>
55
57 This software is copyright (c) 2021 by Ricardo Signes.
58
59 This is free software; you can redistribute it and/or modify it under
60 the same terms as the Perl 5 programming language system itself.
61
62
63
64perl v5.36.0 2022-07-2A2pp::Cmd::Tester::CaptureExternal(3)