Unit testing and Test Driven Development questions
Posted
by
Theomax
on Programmers
See other posts from Programmers
or by Theomax
Published on 2012-09-23T09:25:28Z
Indexed on
2012/09/23
9:48 UTC
Read the original article
Hit count: 267
I'm working on an ASP.NET MVC website which performs relatively complex calculations as one of its functions.
This functionality was developed some time ago (before I started working on the website) and defects have occurred whereby the calculations are not being calculated properly (basically these calculations are applied to each user which has certain flags on their record etc).
Note; these defects have only been observed by users thus far, and not yet investigated in code while debugging.
My questions are:
Because the existing unit tests all pass and therefore do not indicate that the defects that have been reported exist; does this suggest the original code that was implemented is incorrect? i.e either the requirements were incorrect and were coded accordingly or just not coded as they were supposed to be coded?
If I use the TDD approach, would I disgregard the existing unit tests as they don't show there are any problems with the calculations functionality - and I start by making some failing unit tests which test/prove there are these problems occuring, and then add code to make them pass?
Note; if it's simply a bug that is occurring that can be found while debugging the code, do the unit tests need to be updated since they are already passing?
© Programmers or respective owner