Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Automating Writing Regression Tests

by chromatic (Archbishop)
on Dec 22, 2003 at 20:07 UTC ( #316466=note: print w/replies, xml ) Need Help??

in reply to Re: Thoughts on making modules
in thread Thoughts on making modules

I have a tool for that, too. It's ~/bin/newtest:

#!/usr/bin/perl -w use strict; use File::Path; use File::Basename; my $progfile = basename( $0 ); die "$progfile <modname> <test filename>\n" unless @ARGV >= 2; my ($modname, $filename) = @ARGV; my $filepath = dirname( $filename ); mkpath( $filepath ) unless -e $filepath; open my $out, '>', $filename or die "Can't open '$filename': $!"; print $out <<END_HERE; #!/usr/bin/perl -w BEGIN { chdir 't' if -d 't'; use lib '../lib', '../blib/lib'; } use strict; use Test::More 'no_plan'; # tests => 1; my \$module = '$modname'; use_ok( \$module ) or exit; END_HERE

For Some::Module, run newtest Some::Module t/testfile.t.

Replies are listed 'Best First'.
Re: Automating Writing Regression Tests
by Juerd (Abbot) on Dec 22, 2003 at 20:12 UTC

    Hm, that's kind of what h2xs also generates. But I was talking about the actual unit tests, more than just use_ok. Wouldn't it be great if with one simple command, something would analyze a requirements list and translate it to tests? But if that were possible, we could also make it write the code itself, and we'd be out of a job.

    Juerd # { site => '', plp_site => '', do_not_use => 'spamtrap' }

      I started something to this end here. I might actually pick this script up again and iron it out some more.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://316466]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2022-05-20 08:37 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (73 votes). Check out past polls.