header image
Home
NinethSense
My Favorites
Blog
Reach Me
 
My Microsoft
My OpenSource
My Electronics
My Misc Tech
My Project Management
 


Home arrow My Electronics arrow MiscTech arrow Testing for Programmers
Testing for Programmers PDF Print
Written by Praveen V Nair   
Sep 24, 2007 at 08:55 AM
Author: Praveen.V.Nair
Date: Monday, September 24, 2007
Version: 1.0



This article provides basic information about software testing for programmers in a beginner’s level.

Introduction

Explain in detail about subject - testing is out of scope of this article. Just a simple Google search can give you more than enough results. So I wrote this article with just programmers in mind.

Most of the small to medium sized companies do not have separate testing teams. It is usually done by the developers itself. Mostly they do black-box testing (tester may not understand what this product is about!) There may be no test cases. In many situations they deliver the product without testing and as a result the client becomes a tester. As a result the client will think twice or thrice when giving his next project requirement document to the same company.

If we keep some simple points, we can easily improve the quality of the product.

Practical un-documented hints for developers

  • Cosmetics

If your client is not a techie, it is the beautifulness of your product which is going to impress the client. You must be correcting all the:

    • Design issues (alignment, color combination, resolution etc.),
    • Spelling errors (In German – können <> konnen)
    • Compatibility issues (Eg: Your web application may be design problems between IE & Firefox)
    • Captions and statements (If it is not provided by client)
  • Performance

Performance of the product is important. What you feel yourself if you sit in front of the computer for a long time for a simple task? It will be the same feelings for all the end-users. You can make your program perform better. By optimizing your source code, stored procedures, database indexing etc. These subjects are out of the scope. There are many ways to optimize performance in an application.

Well, if it is impossible to fix the performance issue in a module, you may use a progress bar or lime-left text to give the end-user some hope.

  • Structured Programming

Make your source code beautiful. Following a coding standard is always a good practice. You may ask me – 'How can we avoid bugs if we follow coding standards?'. For example, in some programming languages you can see 'do not use GOTO statements'. GOTO statement is considered as un-structured and it can cause end-less loops with minor carelessness.

  • Compatibility

Always use generic methods only. This is mostly applied in web applications. Because we have multiple browsers available and we cannot predict which internet browser end-user will be using. So be careful while choosing client side styles and scripts. Eg: you can give shadow effect for a text with 'filter' css style in Internet Explorer. But it is not effective in non-IE browsers.

  • End-User mentality

Always try to think like an end-user and not a developer. Look at your product from an ordinary person who knows nothing about technology. User friendliness of your product is the major point of this. It is useful only when you start thinking from the beginning of project kick-off.

  • Quality

Quality of a products refers to – security, reliability, usability, portability, efficiency etc. Well, this is out of scope of this article.

What is Software Testing?

    • It is an art of finding bugs.
    • This is to ensure a product is working perfectly.
    • It is to improve the quality of a product.
    • It is a process done by all the developers consciously or unconsciously
    • Picking a bug needs crooked mentality.
    • It is a process of investigation.

Programmers and Testing

As a programmer you must develop only quality programs and it must be challenging for the tester to find bugs. Before handover the product to Testing Team, you must do the thorough testing. Even if you are an expert programmer there will be at least one bug in your product. You know the full know-how of the product and it is always impossible for a second person to understand what you did. So you must be testing your code first. I prefer you do your test each time you finish a module. You have the highest opportunity to do tests in your own program. You must view your program from a different viewport. I will say – the viewport of a criticizer. After your tests you must challenge your testing team to pick bugs from your program. In this way you and your product can improve a lot.

What is programmer's back-end role?

Most of the programming languages provide exception handling techniques (try…catch) to catch bugs. Use error logs to keep those error messages. You can use text files or database to implement this. It is not good to show language errors directly to end-user. Many frameworks are also available to achieve this. Eg: Exception Handling Application Block in Enterprise Library from Microsoft, ELMAH from Google Code etc.

Types of Bugs

The bugs can be permanent or intermittent. Mostly testers might find only permanent bugs. Intermittent bugs are not frequently occurring ones. You may have seen 'alpha' and 'beta' softwares. Companies provide such versions of softwares mostly for finding such bugs.

Testing life cycle

Even though we have proper testing methodologies, only big companies follow them as far as I know. Testing Cycle is always dependant on Software Development Life Cycle.

  • Requirement Study
  • Test Planning – based on the requirements we must choose what things we need to do are.
  • Test Development – Preparation of Test Cases, Development of test scripts etc.
  • Testing!!!
  • Reporting – Testers need to handover the reports to Manager or developers based on results. Usually we use centralized bug-tracking systems in companies.

Types of Testing

  • Black Box Testing

In this method of testing, the testing person does not need to bother about the internals of the product. That means he doesn't need to see the code or database. Anybody with a basic knowledge in computer softwares or web can do this type of testing.

  • White Box Testing

Testing person must have programmer level knowledge to do this type of testing. That means he must knowing programming basics. The tester need to examine the internal things. Since source code examination is involved, this type of testing is usually done by developers itself.

  • Gray Box Testing

This type of testing is usually done for projects which involve complex logics, calculations etc. The testing person may need to query the database directly. We can say this testing method is a combination of Black Box testing and database validations. There are situations which a tester can confirm the working of certains modules by checking the values in database only.

Further More on testing

  • Unit Testing

This is done by the programmers itself. It is achieved by adding small piece of validation codes in to the program itself. These small pieces of codes are used to test even minute modules. Many frameworks are available today. Eg: JUnit, NUnit etc.
  • Integration Testing

Logically this is an extension to Unit Testing. Modules of the same project are developed independently by different programmers. After unit testing of each module they integrates these modules and make a larger module. We do "integration testing" on that to ensure everything is still fine.
  • System Testing

Simply say – requirements verification. This phase is done after developer side testings. The tester need to confirm all the requirements is properly integrated to the system.
  • System Integration Testing

This testing is required if the project have dependencies with external applications or projects. Eg: if your project users output of another computer's application as input. It must be tested in this phase.
  • Acceptance Testing

This is the time in which client decides whether to accept or reject the product. It is actually done by live-end-users or client.
  • Regression Testing

This is executed if the tester finds a bug and programmer modifies the product. Tester needs to ensure no previously reported bugs are reproduced again.

Test Cases

Test cases are an important document for testing. This document explains what testers must test and what the expected outputs are. This is developed based on the requirements of client. Anyway companies follow different formats for this.

Tools for Testing

Here are titles of some of the popular testing tools:

  • Visual Studio Analyzer - Visual Studio Analyzer is a performance analysis tool used for examining and debugging distributed applications.
  • Application Center Test – It is designed to stress test Web servers and analyze performance and scalability problems with Web applications, including Active Server Pages (ASP) and the components they use.
  • Mercury WinRunner – Regression Testing (and more)
  • Mercury LoadRunner – Load Testing (Performance testing)
  • NCover – Code Coverage Tool. This monitors your code while running under test and reports where your code is being exercised
  • NUnit – It is a unit-testing framework for all .Net languages.
  • JUnit – It is a unit-testing framework for Java.
  • Microsoft SQL Profiler – T-SQL Tracing
  • Xenu's Link Sleuth – Checks for broken links
  • validator.w3.org – Online HTML Validator tool

End Notes

I must say this also - we cannot make a 100% quality product with proper testing. All the components in a software development life cycle must be in sync to achieve that. (I will explain this in my another project)

If you found some mistakes in this article, please let me know so that I can correct it.
<Previous   Next>
Microsoft MVP
Trivandrum Microsoft Users Group Forum
MSDN
ASP.net forums
  PHP Kerala Forums
PIT Solutions 



The CodeProject Microsoft Developer Network Official ASP.NET Forums Microsoft .NET Framework Community Microsoft Most Valuable Professional Kidoos.net forums Microsoft Visual Studio Developer Home Professional Information Technology Solutions Microsoft Research Home Trivandrum Microsoft Users Group Community Website