How to Run a Single Test via Dist::Zilla

Last week I was working on a distribution which includes some XS and also uses Dist::Zilla. I needed to edit a single test, but didn't want to run the entire test suite after every edit. It wasn't immediately clear to me how to do this via "dzil test". I asked in #dzil and within a couple of minutes I got some excellent advice in the form of:

dzil run prove -lv t/my-test.t

If there is no XS in your distribution you can skip the build process and get an even faster test run:

dzil run --nobuild prove -lv t/my-test.t

Many thanks to KENTNL for the tip.

5 Comments

unless this is affected by generated code (or it's generated) you could just run `prove -lv t/my-test.t` no need to run dzil at all. I suspect nobuild means dzil build phase doesn't run which means code generation doesn't happen, but I'm not sure.

If you are dealing with XS code, you'll need prove's -b option instead of -l

There is a Build.PL in the repository for that dist, so you should be able to simply: perl Build.PL && ./Build && ./Build test -- or just perl Build.PL && ./Build && perl -Mblib t/foo.t.

Leave a comment

About Olaf Alders

user-pic I hack on MetaCPAN, CPAN modules and other fun stuff.