Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: How do you structure and run module test code?

by toolic (Bishop)
on Feb 23, 2017 at 14:15 UTC ( #1182646=note: print w/replies, xml ) Need Help??

in reply to How do you structure and run module test code?

I use Devel::Cover to make sure I have tests for all my features. This usually means adding checks to existing test files, as opposed to creating new test files.

Regarding the naming of test files, just use names that are meaningful. I always like to have an extremely simple test which does only one thing related to my code (as opposed to the generic pod/load/critic tests). I usually name it basic.t. This makes things easier to debug when things go horribly wrong.

After release, if someone submits a bug report, I normally create a dedicated test file that sensitizes that bug.

Replies are listed 'Best First'.
Re^2: How do you structure and run module test code?
by hippo (Bishop) on Feb 23, 2017 at 14:24 UTC

    That's an excellent point about the bug reports. (++)

    I try to follow this procedure when a bug report is raised:

    1. Write a new test file to reproduce the bug (ie. the test(s) fail on the unpatched code). The test file is named after the report number.
    2. Iteratively: attempt a fix and run the test file until all tests pass.
    3. Release the new version.
    4. Keep the test file in the suite to prevent regression because there is nothing more annoying than having to patch the same bug twice.

    Where possible I try to provide such a test file when reporting bugs in other people's code as it makes less work for them and (hopefully) illustrates precisely what the bug is.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2022-01-24 13:29 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (64 votes). Check out past polls.