Welcome to weblogs.com.pk Sign in | Join | Help

Testing :: Code Coverage :: HTMLEncode :: Classic ASP

Today I received a complaint for the application that I am responsible for then maintenance. Almost 95% of the code written for this application is by my own hand; and most of it was written in 1999 – 2000

The BUG reported; is funny in one sense, but first take a look at the portion of the code where it lies.

I understand that HTMLEncode function requires a valid string, NULL value will throw an error; but checking each value being read from database that it’s valid or not is not feasible; not that it increases development time implementing such things are boring too.

Few days back; I was reviewing the code of my colleague; and his code reads the folder path from the config file. Now he had made an assumption that user of his app will write the folder path correctly; i-e ending with a slash; but what if he doesn’t? Instead of checking and fixing the slashes at each place where it’s used doesn’t make any sense. You should do this at one point i-e where you are reading it from the config file.

I admitted the fault and did the hard work myself; and updated the involved COM library. It now checks the NULL values and replace them with empty string before passing on the recordset to ASP layer. One interesting thing is; I implemented this change only for this particular function because; I didn’t wanted to take any risk. (a) I don’t have unit tests for every aspect of that application (b) The application is very critical and its running smoothly for years and it’s a rule that we should not change the running things.

Considering I wrote the code when I just graduated; and back then test driven development, code coverage and unit testing ideas were not very famous. We used to write code with “It-Just-Work” model. </smile> How do you classify this bug which is notified after about 5-6 years?

Published Friday, December 2, 2005 3:14 PM by khurram
Filed under:


# re: Testing :: Code Coverage :: HTMLEncode :: Classic ASP

Monday, December 5, 2005 2:31 PM by Ali Khan
ultra - benign bug, perhaps!
New Comments to this post are disabled