Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
You don't have to be "test oriented" to start reaping the benefits of using tests.

Some people use tests to drive design. This is what I would call "test oriented." They first think what the program should do, then they write tests to see if it does it (and doesn't do anything else), then they write the code to do it. In the process of writing the tests, they refine their design before they even get to the actual code. Downside: you have spent a lot of coding time before you get any results, and you scrap a lot of tests as you revise your design.

Some people use tests to drive execution. This is often called "programming by contract." In each subroutine, tests are embedded to ensure that design-time expectations meet run-time reality, at entry and at exit. Downside: performance can suffer, and your subroutines start to look like that old public-speaking maxim: "first you say what you're going to say, then you say what you came to say, then you say what you just said."

You can use tests to drive collaboration and deployment. These are often called "smoke tests." Where there's smoke, there's fire. This is probably the most common in practice. Smoke tests are automatable, and smoke tests can be run without any other knowledge of the application. Include a few test scripts with your new code, and reference those tests in your bug reports. Run the tests before you check in changes to your repository. Run the tests every night by daemon and email the results. Run the tests again whenever you upgrade your computer. Run the tests again when a new operating system is released. Run the tests whenever you are idle. The downsides are, well, you have to actually run the tests, and it's harder to ensure the tests are actually providing meaningful coverage.

--
[ e d @ h a l l e y . c c ]


In reply to Re: Testing for Beginners by halley
in thread Testing for Beginners by markmoon

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-03-28 20:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found