Importance of Boundary Value analysis while testing in Database

A few days back, we found a critical issue in production.

The issue that occurred was as follows:

We were given a functionality to test for uploading images for a selected car. There was only a Browse button, and an Upload button in the page.

We had to test if the image name is getting saved in the format

(make year-car make-car model-car version-unique ID.jpg)

We tested it for a number of different cars and functionality was working fine.

But, we missed out one thing.

There was a stored procedure created for saving these image URLs to the database (it was not shared with us. We normally do black box testing.)

Database column being used to save was of size 100 characters, but the stored procedure was storing image URLs in a variable of length 50 characters

Now, the Image names and URLs were getting saved properly for most cars.

But, for cars where Image URLs got greater than 50 chars in length, data got truncated while saving in the database. And this resulted in the images not getting displayed in production.

I was left baffled at first about how I could have caught this bug before release, without having had a look at the SP. How could I have found that variable size was less than what it was supposed to be?

Then it struck me. This is how i am going to work on preventing such defects in the future-

When given a page to test, I will also list out the DB tables that are affected.

For all the columns affected, I will note the size of the column and try to insert values that tend towards the maximum length allowed in the column.

If I had tried this earlier, by selecting longer car names in my effort to reach a 100 char length, I would have found that the maximum length of a possible input into the column was around 76. And in that case I would have found the bug.

I urge you to put this test case as a top priority test case as data truncation is a serious issue. The final goal is to confirm that both the below given conditions are always true:

1. The maximum length of data that a user can input <= The size of the variable in stored procedure that is used to store the value

2.  The size of the variable in stored procedure <= The size of the related Database column


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s