Posted by: ahmedashfaque | January 17, 2016

Why software testing is important?


Sometime back I was working on a project where interest rate needed to be computed for sold goods. The software developers wrote pieces of code for doing tax calculations. When unit testing was performed on that piece of code, it was found that the calculations were coming wrong.

After investigation it was found that though the tax formula used was correct, the error was in wrong data type of the variable used to store tax values coming from the method which used to compute tax amount. For example, suppose the tax rate was 7.5% for a an article which had a selling price of USD 25. The correct tax amount for this article will come at USD 1.875. But it was coming as USD 1.75.

It was due to the fact that the variable which was storing tax rate values (e.g. 7.5%) was defined as an integer data type which could not store decimal places. So it was storing only 7% and the 0.5% part was getting truncated. Thus the tax amount was coming as USD 1.75 instead of USD 1.875.

Thus even though the tax formula used was correct and most of the things were implemented correctly but still wrong tax calculations were coming out because of the wrong data type.

In eXtreme Programming, test driven development approach is used. Testing of business logic is done even before writing source code to implement business logic. This approach traps all kinds of errors which could creep in the source code.

Definitely this approach is the best approach for developing any software product.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Categories

%d bloggers like this: