Venkat Matta

it's all about the Performance Testing

HP Loadrunner Q&A

Advertisements

2 comments on “HP Loadrunner Q&A

  1. kiran
    May 18, 2016

    Hi Venkat,

    Can you please help me out ,how can we do below requirement using Load runner.

    Let’s take 5 different actions Ex: Action1, Action2,Action3,Action4,Action5

    No of Vusers=5

    1 user should perform only Action1
    2 user should perform only Action2
    3 user should perform only Action3
    4 user should perform only Action4
    5 user should perform only Action5.

    Could please write require coding , it will be very helpful

    Like

  2. venkat matta
    May 18, 2016

    Hi Kiran,

    Please find the code below

    Step1 :- Create a parameter VuserID as paramter Type Vuser ID and format = %s

    Step 2:- Create master action and paste the below code

    int VID;

    lr_save_string(lr_eval_string(“{VuserID}”),”str1″);

    VID = atoi (lr_eval_string(“{str1}”));

    lr_output_message(“Vuser ID: %d”, VID);

    if ( VID == 1)

    {
    lr_start_transaction(“TC01_Action1”);

    Action1();

    lr_end_transaction(“TC01_Action1”, LR_AUTO);

    lr_exit(LR_EXIT_ITERATION_AND_CONTINUE, LR_AUTO);

    }

    else if(VID== 2)
    {
    lr_start_transaction(“TC02_Action2”);

    Action2();

    lr_end_transaction(“TC02_Action2”, LR_AUTO);

    lr_exit(LR_EXIT_ITERATION_AND_CONTINUE, LR_AUTO);
    }
    else if( VID ==3)
    {
    lr_start_transaction(“TC03_Action3”);

    Action3();

    lr_end_transaction(“TC03_Action3”, LR_AUTO);

    lr_exit(LR_EXIT_ITERATION_AND_CONTINUE, LR_AUTO);

    }
    else if ( VID ==4)
    {

    lr_start_transaction(“TC04_Action4”);
    Action5();
    lr_end_transaction(“TC04_Action4”, LR_AUTO);
    lr_exit(LR_EXIT_ITERATION_AND_CONTINUE, LR_AUTO);
    }
    else if ( VID ==5)
    {

    lr_start_transaction(“TC05_Action5”);
    Action5();
    lr_end_transaction(“TC05_Action5”, LR_AUTO);
    lr_exit(LR_EXIT_ITERATION_AND_CONTINUE, LR_AUTO);
    }

    Note :- Delete all your child action from Run Time Settings

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on March 22, 2016 by in Loadrunner.
%d bloggers like this: