Monday, February 19, 2007

Scripting techniques in Automation

Abstract
This article details the various automation scripting techniques and their pros and
cons. It also comments on the impact of testing technique on the costs,
programming skills and maintenance
Disclaimer
The author has not referred to any automation project costs documentation or
cost benefit analysis in order to comment on the costs. The readers are
recommended to consume the information at their own understanding and risk.
Document layout
The document briefs on the costs in automation, then on each scripting
technique, it’s pros and cons is outlined.
For the pros and cons, the following approach is used for comments:
ú first comment: Is the approach structured?
ú second comment: What is the test case defined by?
ú third comment: on development costs,
ú fourth comment: on programming skills needed,
ú fifth comment: on planning and management,
ú sixth script: where is the test data located?
ú seventh comment: on script maintenance and cost,
ú any other comments
Costs
The costs associated with test scripting are due to the development effort and the
maintenance efforts. The approach of scripting used during test automation has
effect on the costs
With fragile and easy techniques as ‘record and playback’ the developments
costs are low but the maintenance costs are high and hence the overall costs are
high. With advanced techniques as keyword driven testing, the maintenance
costs are low but the development costs are high and hence the overall costs are
high. The test manager has to choose wisely the technique to minimize the costs.
Various scripting techniques
The various test automation scripting techniques are as follows
1. Linear
2. Structured
3. Shared
4. Data driven
5. Keyword driven
Linear scripting
Linear scripting approach is a simple record and playback used by a test
engineer to automate a test flow/ test case of a system. It can contain some
redundant functions etc that may not be required at times.
Pros and cons of Linear scripting
1. A non-structured way of programming
2. Test case is defined by script
3. Very low development costs
4. Programming skills required by testers are negligible
5. No planning is required
6. Data is hard coded in scripts
7. Script are fragile, and hence maintenance costs are high
8. No sharing of scripts done and hence efforts may be repeated
Structured scripting
Structured scripting uses control structures in the scripts. These control
structures enable testers to control the flow of the test script/ test case. The
control structures are typically ‘if-else’, ‘switch’, ‘for’, ‘while’ conditions/
statements that help in implementing decision making in script, in perform some
tasks iteratively and capacity to call other common functions that house
commonly needed functionality
Pros and cons of Structured scripting
1. A structured approach to scripting
2. Test case is defined by script
3. Programming costs are slightly increased relatively to liner scripting
4. Intermediate programming skills are required by tester
5. Planning is required to some extent
6. Data is hard code in scripts
7. Script maintenance required is less since they are robust, maintenance
costs are relatively lower than liner scripting.
8. Knowledge of scripting language is required in addition to programming
knowledge
Shared scripting
Shared scripting is one of techniques in which the scripts representing a
application behavior is shared amongst other scripts. This means that the
application under test common functionality is scripted as shared scripts and
these scripts are then called by other scripts. This makes the scripts modular in
terms of common functionality. Such scripts due to the functionality can also
cross the AUT boundary and can be used in other software applications as well.
Pros and Cons of Shared scripting
1. Scripts are structured
2. Test case is defined by script
3. Development costs are reduced relative to structured scripting since the
effort duplication is eliminated
4. Intermediate programming skills are required by tester
5. More planning is required due to modularity of scripts
6. Data is hard coded in scripts
7. Script maintenance and maintenance costs are relatively lower than linear
scripting
Data driven scripting
This technique separates data from the scripts and stores it into external
repository as disk in form of files. So the script contains just the programmed
code. This may be needed when the data needs to be varied over the test run.
This the script need not be modified if it is data that undergoes a change. At
times the expected data can also be stored in the data files that have test data.
Pros and Cons of Data driven scripting
1. Scripts are programmed in a structured manner
2. Test case is defined by test data/ script
3. Development costs required are relatively high as compared to the shared
scripting due to parameterization and programming efforts
4. Intermediate to high programming skills are required by tester
5. More planning is needed
6. Data is isolated into data tables or external files
7. Script maintenance is as low
8. Recommended to be used where positive and negative data testing needs
to be performed
Keyword driven testing
It is an approach in which the control to check and execute operations in
maintained with external data files. So the test data and the operations/sequence
of the test is planned in external data file and extra library is need to interpret this
data in addition to the conventional script. It is an extension of data driven
testing.
Pros and Cons of Keyword driven testing
1. Combines the data driven, shared and structured scripting approach
2. Test case is defined by data
3. Development costs are high since more efforts are needed for test
planning and development
4. High programming skills are required by tester
5. Initial planning and management efforts are very high
6. Data exists in external files
7. Maintenance costs are low
8. Extra framework or library is needed and hence more programming skills
as well needed by tester
Comments on development costs
ú As the scripting approach changes from liner to keyword driven
scripts, the development costs are increases.
Comments on maintenance costs
ú As the scripting approach changes from liner to keyword driven
scripts, the maintenance costs decreases.
Comments on Programming skills
ú As the scripting approach changes from liner to keyword driven
scripts, the proficiency required in programming for a tester
increases.
Comments on planning and management required
ú As the scripting approach changes from liner to keyword driven
scripts, the amount of planning required to manage the automation
project increases.
References
1. Software Test Automation: Effective use of test execution tools by Dorothy
Graham and Mark Fewster

No comments: