Greetings Avout, I'm attempting to use TAP::Harness to test CFEngine policy and I'm having trouble creating the final test commands. The following code is supposed to check the TAP output for these two commands:
/usr/bin/cf-agent -D efl_returnszero_csv -Kf ./promises.cf /usr/bin/cf-agent -D efl_returnszero_json -Kf ./promises.cf
The -f switch must have the ./promises.cf argument. When I run prove t/efl_returnszero.t I get this error:
t/efl_returnszero.t .. No subtests run Test Summary Report ------------------- t/efl_returnszero.t (Wstat: 0 Tests: 0 Failed: 0) Parse errors: No plan found in TAP output Files=1, Tests=0, 2 wallclock secs ( 0.03 usr 0.00 sys + 1.54 cusr + 0.04 csys = 1.61 CPU) Result: FAIL
My guess is that the final commands are coming out in a scrambled order resulting in no output, but how can I test that?
#!/usr/bin/perl use strict; use warnings; use Carp; use TAP::Harness; chdir 'test/masterfiles' or croak "Cannot cd to test/masterfiles $!"; my @tests = ( [ './promises.cf', 'using_csv' ], [ './promises.cf', 'using_json' ], ); # Final test command is exec + element from test + arg? my $harness = TAP::Harness->new({ exec => [ qw( /usr/bin/cf-agent -Kf ) ], test_args => { using_csv => [ '-D efl_returnszero_csv' ], using_json => [ '-D efl_returnszero_json' ], }, verbosity => 1, errors => 1, show_count => 1, }); $harness->runtests( @tests );
UPDATE: turns out the test args cannot have white space so
test_args => { using_csv => [ '-D efl_returnszero_csv' ], using_json => [ '-D efl_returnszero_json' ], }, # Must be: test_args => { using_csv => [ '-D', 'efl_returnszero_csv' ], using_json => [ '-D', 'efl_returnszero_json' ], },
Neil Watson
watson-wilson.ca
In reply to Testing non perl app using TAP::Harness by neilwatson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |