You don't need to make your distribution look like the structure that h2xs gives you, so stop worrying about h2xs. You can look at other utilities, like Module::Starter. You might want to create a fake distro just to see what it does and how it works. In the same way, you don't need a Makefile.PL to test, although it does help. You want to get there eventually, but if testing is more important at the moment, you can skip it for now.

You can use the prove(1) function that comes with Test::Harness. You tell prove where to find the modules, and which test files to run, and it handles the rest. If you write the tests first, this is the quickest way to get going.

I suggest that you start off so that you can move towards a Makefile.PL (or a Build.PL if you want to use Module::Build instead]. Put all of your tests in a directory named t since that's where Makefile.PL and Build.PL look for them by default.

As for writing the tests, I like to make a lot of small test files, usually one per function in the public interface at least. That's mostly a matter of taste. With prove, you can limit your tests to just the files you want, so if you have a lot of test files with a small number of tests, you can break down your testing easily. With only a couple of test files that each have a large number of tests, you might have to sit through a lot of tests that you don't care about at the moment.

Once you are ready to create the Makefile.PL, I suggest you look at a couple on CPAN and find one that looks simple and close to what you want, then copy it. You'll be able to tell Makefile.PL where to find the modules (they don't have to be in a lib/ directory), where to put other files like executables, and so on. The ExtUtils::MakeMaker documentation has all of the details, and don't let it scare you off in the first two minutes. ExtUtils::MakeMaker::Tutorial will help too, as will perlmodstyle and perlnewmod.

As for creating good test cases, look around and you'll find a lot of advice on testing. Good luck :)

--
brian d foy <bdfoy@cpan.org>

In reply to Re: Testing a already built application by brian_d_foy
in thread Testing a already built application by ropey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.