Unit testing - getting started

Posted by higgenkreuz on Programmers See other posts from Programmers or by higgenkreuz
Published on 2011-11-21T06:24:38Z Indexed on 2011/11/22 10:25 UTC
Read the original article Hit count: 302

Filed under:

I am just getting started with unit testing but I am not sure if I really understand the point of it all. I read tutorials and books on it all, but I just have two quick questions:

  1. I thought the purpose of unit testing is to test code we actually wrote. However, to me it seems that in order to just be able to run the test, we have to alter the original code, at which point we are not really testing the code we wrote but rather the code we wrote for testing.

  2. Most of our codes rely on external sources. Upon refactoring our code however, even it would break the original code, our tests still would run just fine, since the external sources are just muck-ups inside our test cases. Doesn't it defeat the purpose of unit testing?

Sorry if I sound dumb here, but I thought someone could enlighten me a bit.

Thanks in advance.

© Programmers or respective owner

Related posts about unit-testing