B
bwooster47
When creating Perl modules, there is Test::More and similar tools
available to automate the testing.
Are there general guidelines for writing test scripts that work with
the Test::Harness framework?
I noticed Test::Script - it offers one function -
"script_compiles_ok()"
But if I need more - what are some good practices for testing the full
script:
1) run script with --arg1 --arg2, check that STDOUT has a line with
"text line 1"
2) run script with --arg3 file, check that file was created (and then
clean up - remove it)
3) run script with --arg4, check that Unknown Arg error is thrown
One option is just to write the perl code to execute the above
commands, and do the checks. But how to run the command - "make test"
puts the script in blib/script, the script itself is in bin/, and
there may be a system installed old script version, so need to make
sure that the test is running the script from the development folder.
Any suggestions?
available to automate the testing.
Are there general guidelines for writing test scripts that work with
the Test::Harness framework?
I noticed Test::Script - it offers one function -
"script_compiles_ok()"
But if I need more - what are some good practices for testing the full
script:
1) run script with --arg1 --arg2, check that STDOUT has a line with
"text line 1"
2) run script with --arg3 file, check that file was created (and then
clean up - remove it)
3) run script with --arg4, check that Unknown Arg error is thrown
One option is just to write the perl code to execute the above
commands, and do the checks. But how to run the command - "make test"
puts the script in blib/script, the script itself is in bin/, and
there may be a system installed old script version, so need to make
sure that the test is running the script from the development folder.
Any suggestions?