10 TOP TIPS FOR AUTOMATED PERFORMANCE SCRIPTS
Here are our top ten tips for avoiding common pitfalls when automating performance scripts:
a). ERROR HANDLING
Always attempt to validate that the automation is where it should be. If it is not, then try to recover the automation back to the starting point.
b). START AND FINISH AT THE SAME POINT
Logon and logoff processing should occur only once, unless there is a specific requirement. As the script iterates, the automation should finish an iteration at the point it started.
c). ADD COMMENTS
Scripts should be well commented, detailing the purpose for the script as well as the individual steps.
d). RESPONSE TIME COLLECTION
Response times for key actions should be collected.
e). ADD RANDOM ELEMENTS
Wherever possible, data should be random as much as possible, e.g. postcodes entered should vary. Where a range of data is used, these can be stored in external files, which are accessed by the automation. Navigation through a function should also vary, e.g. locating a customer based on name as well as postcode.
f). ADD LOOPS
Repetitive actions should be placed inside loops.
g). ADD SUBROUTINES
Large blocks of code that are placed inside nested if statements, or are repeated in the automation can be placed in a subroutine that is called. This aids the readability and maintenance of the automation.
h). ADD PARAMETER TABLES
Some variables entered need to vary so that different parts of a database table are accessed. Data like this can be placed in parameter files so that different values are used for each iteration of the business flow.
i). ADD REALISTIC USER WAIT TIMES
User think time should be placed at appropriate points inside the automation to simulate the way a real user keys a function.
j). STANDARDS
Naming and other standards should be in place to assist readability of the automation, and to help the automation work together when several people are involved in coding the scripts.