10 Top Tips for Automated Performance Scripts
Here are our top ten tips for avoiding common pitfalls when automating performance scripts:
- 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.
- 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.
Scripts should be well commented, detailing the purpose for the script as well as the individual steps.
- Response time collection
Response times for key actions should be collected.
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.
Repetitive actions should be placed inside loops.
- Sub routines
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.
- 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.
User think time should be placed at appropriate points inside the automation to simulate the way a real user keys a function.
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.