Click here to Skip to main content
15,867,686 members
Articles / DevOps / Load Testing

Testing for Programmers

Rate me:
Please Sign up or sign in to vote.
2.85/5 (21 votes)
23 Sep 2007CPOL8 min read 39.2K   20   5
This article provides basic information about software testing for programmers in a beginner’s level.

Introduction

Explain in detail about the 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. Consequently, the client will think twice or thrice before giving his next project requirement document to the same company.

If we keep some simple points in mind, 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 (E.g.: Your web application may have design problems between Internet Explorer & Firefox)
  • Captions and statements (If it is not provided by the client)

Performance

Performance of the product is important. How do you feel if you sit in front of the computer for a long time for a simple task? It will be the same feeling 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 scope of this article. 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 the end-user will be using. So be careful while choosing client side styles and scripts. E.g.: You can give shadow effect for a text with 'filter' CSS style in Internet Explorer. But it is not effective in non-Internet Explorer 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 the 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 handing over the product to Testing Team, you must do a thorough testing. Even if you are an expert programmer, there will be at least one bug in your product. You have 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 a Programmer's Back-end Role?

Most of the programming languages provide exception handling techniques (trycatch) 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 the end-user. Many frameworks are also available to achieve this. E.g.: 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.
  • 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 software or web can do this type of testing.

White Box Testing

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

Gray Box Testing

This type of testing is usually done for projects which involve complex logic, 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 in which a tester can confirm the working of certain modules by checking the values in database only.

Further More on Testing

Unit Testing

This is done by the programmers themselves. It is achieved by adding small piece of validation code into the program itself. These small pieces of code are used to test even minute modules. Many frameworks are available today. E.g.: 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 integrate 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 needs to confirm that all the requirements are properly integrated to the system.

System Integration Testing

This testing is required if the project has dependencies with external applications or projects. E.g.: If your project uses the output of another computer's application as input. It must be tested in this phase.

Acceptance Testing

This is the time in which the 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 the client. Anyway, companies follow different formats for this.

Tools for Testing

Here is a list 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 too - 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 find some mistakes in this article, please let me know so that I can correct them.

History

  • 24th September, 2007: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect ORION INDIA SYSTEMS
India India
Praveen.V.Nair - aka NinethSense - PMP, Microsoft MVP - is working as a Head of Technology and Architecture at Orion India Systems, Kochi, India. He has been playing with electronics from the age of 10 and with computers from the age of 14. He usually blogs at http://blog.ninethsense.com/.

Comments and Discussions

 
GeneralMy vote of 5 Pin
Nuthan Murarysetty15-Jul-13 23:59
Nuthan Murarysetty15-Jul-13 23:59 
GeneralGood work, waiting second part!! Pin
babalao24-Sep-07 8:31
babalao24-Sep-07 8:31 
Nice article. It will nice to have a second part, with some best practices and for example explain how much time invest doing testing depending the type testing. Is there a way to clasify bugs?

This article it's great because it allows you to grow as a better developer and not just simple programmer that follow requierements.

Got my five Smile | :)
GeneralRe: Good work, waiting second part!! Pin
Praveen Nair (NinethSense)24-Sep-07 18:33
Praveen Nair (NinethSense)24-Sep-07 18:33 
GeneralRe: Good work, waiting second part!! Pin
Praveen Nair (NinethSense)24-Sep-07 18:34
Praveen Nair (NinethSense)24-Sep-07 18:34 
QuestionHow about this... Pin
yafan24-Sep-07 4:06
yafan24-Sep-07 4:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.