Choose Your Own Tutorial
Testing Your Distribution
Dist::Zilla saves you from wasting a lot of time on things like boilerplate documentation and bumping version numbers. You can take that free time and channel it into writing better tests, right? Right! Of course, with tests written, you'll want to be able to run them.
prove to run tests
No matter what configuration you're using, testing a distribution will usually be possible with the very simple shell command:
$ prove -lr t
This uses the prove program to run the test files under ./t using the libraries in ./lib. Dist::Zilla won't be involved, so it can run very quickly. There are a few things to keep in mind, though:
$VERSIONvariables come from Dist::Zilla, they won't be present.
If Dist::Zilla constructs files needed for your tests, they won't be there.
If your dist uses XS, this pretty much won't work.
dzil test to run tests
If your dist needs to be built for your tests to run, or if you just want to make sure your tests still run with the built version of your dist, you can run another simple command:
$ dzil test
This will build your distribution and run its tests in the build directory. It should be exactly the same as what an installing user would be trying to do. If all the tests pass, the build directory will be deleted afterward. If tests fail, it will be left in place so you can inspect the wreckage.
Running your tests before releasing
You should run your tests immediately before you release your code, to be sure that the thing you're about to upload is working. You can tell Dist::Zilla to run your tests as part of the release process, aborting the release if they fail, but continuing on if they're all successful.
If you'd like to learn about how Dist::Zilla builds your dist, turn to page 12
If you'd like to learn how to release your newly-tested dist, turn to page 8