Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: *How* Do I Get Involved?

by jplindstrom (Monsignor)
on Oct 11, 2001 at 18:38 UTC ( #118224=note: print w/replies, xml ) Need Help??

in reply to *How* Do I Get Involved?
in thread How You (Yes You!) Can Get Involved

Writing tests are good for (well... at least) two reasons.

1. You think about what you do, how your code is to be used. You consider (and maybe discover some) boundary conditions and make sure your code doesn't break on them. It forces you to think about your interfaces and make them explicit (because otherwise, how do you know how the tests should succeed or fail?).

2. Tests, even the simplest one, is encoded documentation of what works _now_. So what? If you later change something that breaks even the simplest thing, your test suit will tell you. This is regression testing. This is tangible confidence during maintenance.


Replies are listed 'Best First'.
Re: Re: *How* Do I Get Involved?
by Ea (Chaplain) on Oct 11, 2001 at 20:04 UTC
    I suppose I'm looking for a Dick and Jane guide. I've only tested one value and I should test boundary conditions, but I feel I should also be trying to break it in other ways and look at the results. Looking at it right now, there's no validity checking on the input. I only feed it numbers, but there would be nothing stopping someone from feeding it characters. Well, perhaps that's the Right Thing to do, instead of restricting someone else's use of the code. It comes down to the difference between broken code and "creative" use yielding unexpected results.

    Ea :wq

      There will be a couple of articles on testing published on shortly. Skud (from e-smith) is using real-world examples from her job. I don't know the exact status, but she expected to have the first one ready sometime this week.

      If there are still questions after that, let me know, and I'll work up another article. (If you have specific questions about a chunk of code, drop me a message and I'll take a look at it.)

      Update: Here's one article. I promise I'm not Skud; we've been seen in public in the same room.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2022-08-13 09:43 GMT
Find Nodes?
    Voting Booth?

    No recent polls found