So, we have come up with an approach of placing all the common functions/user actions/custom code within a single header file thereby making the scripts dynamic and less complex. Moreover , we'll also share the list of functions that would be used for fetching the records directly from database and using them within the LR scripts without maintaining any parameter file or flat files.
Advantage of having this common header file
- Easy maintenance of the scripts with less manual intervention
- Effective debugging at functional level
- Easy to port to different environments
- Write/Update once and reflect everywhere
To understand the framework, here is a case where we have placed the commonly used actions and the query to fetch the records from the database (like Payment ID) within the CommonActions.h file (header file). The script specific actions are kept within the LR scripts, and those are executed from the script itself.
In addition to that, there will be cases where we need to execute tests in multiple test environments and these tests has to be triggered one after another. Given the minimal time gap between each test, the best way is to have them in one centralized location and call it from our script. In this way, we can make debugging easy and make changes at one place that will reflect in all the scripts.
Commonly used functions for fetching the records from database-
1. lr_db_connect - establishes a connection with the database
2. lr_db_executeSQLStatement - Oracle/SQL queries are written within this function
3. lr_db_getValue - fetches a value from the dataset
4. lr_db_disconnect - disconnect the connection from database
Stay tuned for more posts!!!
Short n descriptive... helped me alot... Thanks.
ReplyDeleteI would like to know- In loadrunner which protocol should we use to establish connection with database?
You can either use Oracle - 2 Tier or Web Services protocol for connecting to DB
DeleteThanks Datta, this approach will definitely save the time for data creation before the test executions
ReplyDeleteNicely Explained...
ReplyDeleteThanks,
Gagan
http://perfmatrix.blogspot.in