[Pdx-pm] Rearranging tests

Eric Wilhelm scratchcomputing at gmail.com
Sun Nov 13 09:23:12 PST 2005


Hi all,

Has anyone else had this same sort of issue?  I got tired of naming 
tests 00-foo.t, 01-bar.t, etc because of a few reasons:

1.  I can remember the name much better than the number (when I want to 
run or edit a test, having to figure out the number before tab-complete 
will work is annoying.)

2.  I don't know what order I want to run them in when I create them, 
and want to be able to change that order later.

~3.  vim thinks that *.t files are "tads" format.  (I know there's a way 
around this, but this is more a "yet another reason" than a sole 
motivation.)

So, I got a start on the Perl Test Juggler (ptj), and it looks like it 
will work.  For now, it only works on real operating systems because 
the current method is very symlinky.

The code is in my svn/, but there's no installer yet, so you have to 
*really* want to try it.  It's also not quite production-ready, so 
feedback is really cool.

"ptj init t/" will rename all of your /^\d\d-(.*)\.t/ tests to $1.pl and 
create symlinks back from the original names to the .pl files.  It will 
also create t/order.ptj, which allows you to rearrange the order with 
"dd,p" in vim.  It also sorts your MANIFEST file and makes sure that 
all of the *.t tests are included.  If it detects that you're in an svn 
or svk working directory, it does the rename as "$vcs mv" and then does 
an add of the new symlinks.  (Unfortunately, this is currently an 
irreversible svn action (unless I break it into two steps make it 
automatically checkin between the rename and the symlink creation.)

"ptj up t/" will update the symlinks if you've changed the t/order.ptj 
file.  It also does the MANIFEST and vcs tricks.

I don't use cvs, but it's possible to add support for it (except it 
doesn't support symlinks right?)

Ok.   That's about all it does.  It's possible to do it on windows, but 
then it only re-orders the tests (in an svn-aware way.)  Would you want 
to go without symlinks on *nix-like systems?

Even if you don't want to use symlinks, the ability to re-order your 
tests automatically (including updating MANIFEST and doing all of the 
svn/svk/cvs stuff) has to be at least somewhat useful.

Thoughts?  If there's enough interest, I could give a presentation as 
early as the next pm meeting.

Thanks,
Eric
-- 
"It is impossible to make anything foolproof because fools are so 
ingenious."
--Murphy's Second Corollary
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------


More information about the Pdx-pm-list mailing list