Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Test harness for scripts?

Reply
Thread Tools

Test harness for scripts?

 
 
bwooster47@gmail.com
Guest
Posts: n/a
 
      05-16-2007
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?

 
Reply With Quote
 
 
 
 
Sisyphus
Guest
Posts: n/a
 
      05-17-2007

<> wrote in message
news: ups.com...
> 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?


Any file with a '.t' extension that's placed in the './t' folder will be
automatically run by 'make test'.
There are other options, too, but that's how most people create their test
scripts.

..
..
> 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.
>


I don't think this is a consideration at all.
The test scripts themselves (ie the '.t' scripts in the './t' folder) don't
get put into blib - they stay where they are.
Also, 'make test' will find (and use) the files in blib *before* it goes
looking for files (in @INC) that have been installed into perl as a result
of an earlier build. (That is, if the file exists in blib, then that's the
one that 'make test' is going to use.)

Cheers,
Rob

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with invoking DRY with generics in test harness Todd Java 0 03-17-2008 05:40 PM
Test::Harness and test values. yusuf Perl Misc 4 08-09-2006 07:00 PM
Test Harness? Troy Denkinger Ruby 10 03-10-2006 05:34 AM
Test Harness Strategies fabbl VHDL 1 04-17-2004 03:39 PM
test test test test test test test Computer Support 2 07-02-2003 06:02 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57