Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^5: Neither system testing nor user acceptance testing is the repeat of unit testing (OT)

by tirwhan (Abbot)
on Oct 25, 2005 at 10:07 UTC ( #502652=note: print w/replies, xml ) Need Help??


in reply to Re^4: Neither system testing nor user acceptance testing is the repeat of unit testing (OT)
in thread Neither system testing nor user acceptance testing is the repeat of unit testing (OT)

I think TDD is only done correctly if unit tests are black box. You write your tests and thereby define your interface, regardless of the implementation behind it. Once you get to the refactoring stage you (may) change your implementation to make your code better organized|more efficient|less redundant|etc. Your refactoring succeeds if you manage to change your implementation without breaking a test. If you then have code that's not being tested, you have one of two cases

  1. Your tests don't accurately describe your interface, because you forgot to test for an outcome that should be part of your spec.
  2. The untested code should be removed because it produces an outcome not included in the spec (because ideally your tests are the most thorough description of the spec)

In the case of 1. you need to add a test, but you still want to test against the module interface, not against the particular implementation. This is a corner case where you're actually finding a better interface by coincidence while refactoring. If you're writing your tests correctly it shouldn't happen (though IRL it does).

I do agree that it takes a special sort of mindset to properly separate your test-writing brain from your implementing brain, so that's a practical problem for all but the schizophrenics among us :-).

  • Comment on Re^5: Neither system testing nor user acceptance testing is the repeat of unit testing (OT)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2019-11-19 18:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (95 votes). Check out past polls.

    Notices?