Thursday, January 3, 2008

Test case designing for Automation

Abstract
Test case development is an essential activity in Quality Assurance of enterprise application. There are various traditional methods and approaches for test case development. This document will throw the light on some pain areas of traditional test design methods and their remedy; this is an out of box thinking to re vamping the test design activity and approach to reduce the test time, cost and increase the quality.

Introduction
This document has been written for Test engineers who wish to develop test cases for enterprise applications, which deals with huge data and transitions based on that, assuming they have some conceptual knowledge of test case development and test Automation.


This Artical Covers
The first section covers the pain areas of traditional Test Case Development; concepts of test case development and typical style followed for that, things which increase the lengthiness of test cases, limitations or complexities for automation, execution fatigue etc.

The second section Introduces the new Technique and its implementation to reduce the pains; what is Data repository, how to implement that, how to develop test cases based on that, does it overcome the drawbacks of traditional technique? Etc.

The third section explains a Real-life example; makes more familiar with the new technique, its implementation, and use.

Finally, Its advantages/benefits to Test execution and automation; normal process of manual execution and automation development, requirements, pain areas of executers and automation developer, speed issues, benefits of this new techniques. Etc.

Pain areas of traditional Test Case Development
Test case is nothing but a set of instruction which relates the supplied input to desired output.
Normally test case is divided into
Test case ID
Test area- feature
Test case title
Test steps
Test verification
Let’s take an example of complex (EtoE) scenario on which we have to develop a test case. What we will do? We will follow the above technique/format to bifurcate that scenario.
What if our test objective is simple but we need to do various setting in that application to make a platform on which we need to run our test condition. The test steps may go on increasing. It may be like that our actual execution instructions may be of 5 to 7 steps but building platform for that may of 20 to 25 steps so total test will be of 25 to 30 steps.
Execution of such test case is really time consuming job. It may bring execution fatigue and effect quality of execution.
If we expect its automation, then it will be time consuming for programming as well as during the automation run; As we have do cleanup in our automation it will be of 50+ steps case which is extremely time consuming.

Introduction to new Technique and its implementation to reduce the pains

I think, you might be encountered these problem in past. Whenever a test case requires some test setup to be performed before executing actual steps, we call it prerequisites. The same test setup might be or might not be applicable for another test case. But it is mandatory to do these prerequisites to run our test case.
What can we do now? Is there any way to eliminate our pains?
QA Data Repository is really good solution for this.
What is QA Repository?
It is the collection of prerequisites on top of which tests can be written and run.

How to implement that?
1 Identify all data which is prerequisite.
2 Normalize this data.
3 Create reusable data which may be common for number of test cases.
4 Define norms for adding new data, its utilization within the test cases.
5 Keep this data in separate worksheet of test case development excel.
Based on this solid foundation start developing test cases. This will reduce our pains up to certain extend but still we have not eliminated this.

Create this data manually in your application. Take the database copy and preserve this. When ever new build arrives, just restore the backup and you are ready to run the cases on the top of prerequisitesJ. This is fantastic. It reduced our overheads considerably.

Real-life example
Let’s take an example of testing a banking application. Our requirement is to test the business rules for this application.

One end to end scenario
An account holder has made some payment to another valid account holder of the bank of RS 2000, using his web account. The amount credited to second account holder’s account and debited from first accounts holder’s account.

Normal test case development technique (Fig 1 -Test 1)


Going through the above test case gives an idea that the Steps #1 to #14 are not directly related with Test objective. But without doing that we can’t test the expected behavior, so it becomes prerequisite for the test case.
How can we implement the QA Repository to this situation?
QA Repository
To Implement the QA Repository, first identify all data which is prerequisite. Normalize this data in such manner which creates reusable structure; it may be common for number of test cases. Define norms for adding new data, its utilization within the test cases. Below is the QA repository created for the above mentioned test. (Fig 2 -QAR)

New test case based on QA Repository (Fig3 - Test 2)

Now create the database backup of this repository. When ever a new build arrives restore the backup and we are ready to for execution
Now we can conclude that it really reduced the pains of test execution.
Advantages/benefits to Test execution and automation

Benefits for Manual Execution
This technique is very useful in manual execution and Automation development. It helps to develop automation friendly test cases and reduces bulkiness of the test cases.
1. Reduces the execution time.
2. Reduces Execution fatigue
3.Improve productivity
4. Provide better results Quality

Benefits for Automation
When we plan to automate the set of functional test for regression we need to consider number of factors. One of the factors is the complexity of test cases. In this approach of test case development, we have reduced actual number of steps in the test case which defiantly reduces the complicity of automation. There are number of benefits during the development and automation run.
1. Reduced time on managing pre-requisites at actual automation of test cases.
2. This helps for developing the generic functions for code reusability.
3. It reduces the pains of developer for mapping the verification i.e. Strong and confirmed statements for test case passing and failing.
4. As a part of TC’s deliverables it is Easy to send the Data Repository.
5. No mismatch of Application settings during automation of each Test Case.
6. Reduces required time for automation run considerably.

Conclusion
In Nutshell, Eliminating the pre requisites as a part of test case will defiantly helpful. This is a good approach for test case development and overall it is applicable for all applications which deals with data and transitions based on that.