Techknow Study

Load Runner Script Development Framework

11:54:00 AM Gautam Datta 0 Comments Category :

Load Runner Script Development Framework

In general, for any project, we develop scripts, create test data and execute the scripts. During the tight project schedules, we do not have time to create the data & synthetic data that we create might not match accurately with PROD Env so we have come up with innovative idea of fetching the data form the DB directly
We query the test data from database and execute the scripts, using custom coding in Test scripts and were able to establish the database connection using Loadrunner functions -- lr_db_connect

There are some scenarios where we think of having a single header file with all the reusable functions and this header file will be executed from the Load Runner script.  

Advantage of having this common header file

ü  Easy Maintenance of the scripts
ü  Effective debugging at function level

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.

In any projects, if there are some actions common to all the scripts, this framework helps.  Having all the common actions in one header file avoids redundancy, duplication and facilitates in having a defined and structured script framework. This way we can also make the script easily understandable, reduces the chances of making mistakes and allows us to make modifications very quickly with less manual intervention.
To understand the framework, here is a case where we have the commonly called actions in a header file and this header file will again interact with database to query for particular id, retrieve it and again call the function in the header file.  There will always be some actions, which will be script specific, and these are executed from the script itself.


                                                 Load Runner Script Frame work:



If we see in the above flow chart, HomePage (), Login (), IDSearch (), Logout () are common for all the scripts.
The ID Search will query the data from database and there is a column status to track the data whether it is reusable or unique. After querying the data, the status is modified accordingly.  This way we can track the data that is consumed in the test executions.
After the ID is queried from the database, there are certain script specific requests that are kept in the script itself and in the end again calling logout , which is a common action, is called from the common header (CommonActions.h).

RELATED POSTS

0 comments