VuGen Scripting Best Practices
- July 24, 2013
Virtual User Generator (VuGen) is an HP LR component used for test script creation. In performance testing, we replace the real user with virtual user (Vuser) and use VuGen for capturing real user business actions on application under test (AUT). Vuser script created in VuGen can be used in HP LoadRunner, HP Performance Center as well as in HP Business Availability Center. HP VuGen is considered as one of the finest Vuser scripting tool that is equipped with all the desired scripting capabilities with a user friendly interface.
VuGen Record & Replay Feature
Most Vuser scripting tools assist their users by allowing them to record their actions instead of hardcoding them. VuGen possesses very powerful recording capabilities. A performance tester can easily record complicated user actions by just providing the URL (in case of web applications) and interacting with the AUT.
VuGen Recording Engine Limitations and their Solution
Preparing the VuGen script which could be further used might not be possible with recording feature only. A performance test can only be accurate if you could appropriately simulate the real users’ behavior. A recorded script just provides you the basics for creating realistic user actions. You always need to implement the script enhancement techniques to make the Vuser actions more realistic. Some of these script enhancement techniques are as follows:
Parameterization facilitates in a way that it allows you to run the recorded script with different set of inputs (e.g. login) for different users. It makes Vuser script more realistic instead of running the script with same set of values which could produce invalid test results due to caching of these values. It’s also possible that the application might not allow you to submit same set of inputs for every Vuser and throw errors.
It’s very likely possible that your script might contain dynamic server values and script might fail or produce inaccurate results during recording. VuGen provides the correlation feature to pick such values directly from the server instead of using the recorded values.
Transactions are inserted to measure particular business scenario response time. As response time is the most demanding performance parameter, all important user actions should be covered in transactions. Keep think time out of the transaction boundaries to get the most accurate response time.
You can also divide your script into multiple actions to make it more structured and readable. By default, VuGen has 3 actions, vuser_init, action and vuser_end. It’s recommended to keep the login script in vuser_init action, user business actions within Action and logout in vuser_end action.
In various situations during performance testing you need to insert simultaneous load from all the available Vusers on a particular transaction. Rendezvous points help in achieving this.
It’s always strongly recommended to verify the script authenticity after recording and enhancements before putting it under heavy user load. It will not only increase your confidence on your script but would also save you from the last minute glitches. Following are some of the useful techniques used to verify the VuGen script:
Reply with Extended log Enabled:
Replaying the enhanced script by enabling the extended log (all options) provides you with the detail of user requests and server responses on them in reply log. An error free reply log is one step closer towards a successfully created script.
Test Data Verification:
You can validate the accuracy of your script by checking whether your scripted data is being submitted to the AUT or not. Replay the enhanced script which contains some user transactions where data is being written on the server. If your test data is submitted, it means that your script is working.
You can validate user navigation actions where no data is being submitted to server through checkpoints. By inserting Text and Image checkpoint you can validate the system response on recorded user actions.
You can also insert custom messages on different sections of your script in order to validate your script.
Once you have validated your script through above methods, a final check could be to run the test with 3 – 5 Vusers from Controller and check the application data and server log.
VuGen scripting is not all about recording the user actions. Realistic performance test results can never be achieved without accurately simulating the user actions. Most often you need to parameterize and correlate your script along with inserting multiple transactions, actions and rendezvous points to incorporate real users’ behavior. Moreover, script validation through application inserted data, checkpoints, server logs and baseline test is also extremely important to build confidence on your script.