Highlighted
Absent Member.. Absent Member..
Absent Member..
1063 views

saving duration as a parameter in a vugen script

Jump to solution

Hi All,

I want to save the duration of a transaction as a parameter (time which takes to script runs and completes) and according to this parameter I want to define if transaction fails. for example if it takes more than 5 seconds for transaction to be completed I want it  to finish with lr_end_transaction ("transaction_name", lr_fail)

is there a way to do this?

thanks

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: saving duration as a parameter in a vugen script

Jump to solution

Hi PavanKumar,

 

thanks for reply,

I added the codes to the script but it did not work.

in this script I want to ping an IP and if I can not ping it I want the script fails.

the script is below. although I can not ping the IP is sasys transaction pass.

 

Action()
{
    double wasteTime, actualElapsedTime;

  
merc_timer_handle_t MasterT2; 

 

    lr_start_transaction("Ping_Tempo");
    MasterT2 = lr_start_timer();
 
    system("ping X.X.X.X");
    if (actualElapsedTime<=5)

          lr_end_transaction("Ping_Tempo",LR_PASS);

else

 

          lr_end_transaction("Ping_Tempo",LR_FAIL);


    return 0;

View solution in original post

0 Likes
5 Replies
Highlighted
Established Member..
Established Member..

Re: saving duration as a parameter in a vugen script

Jump to solution

you could do this.

 

 

   double wasteTime, actualElapsedTime;
    merc_timer_handle_t MasterT;

 

lr_start_transaction("myTransaction1");
// Examine the total elapsed time of the action
    MasterT = lr_start_timer();

.....

..... your w_s_d or any other code

 

actualElapsedTime = lr_end_timer(MasterT);

 

if (actualElapsedTime>=something)

          lr_end_transaction("myTransaction1",LR_PASS);

else

 

          lr_end_transaction("myTransaction1",LR_FAIL);

 

 

Pavankumar
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: saving duration as a parameter in a vugen script

Jump to solution

Hi PavanKumar,

 

thanks for reply,

I added the codes to the script but it did not work.

in this script I want to ping an IP and if I can not ping it I want the script fails.

the script is below. although I can not ping the IP is sasys transaction pass.

 

Action()
{
    double wasteTime, actualElapsedTime;

  
merc_timer_handle_t MasterT2; 

 

    lr_start_transaction("Ping_Tempo");
    MasterT2 = lr_start_timer();
 
    system("ping X.X.X.X");
    if (actualElapsedTime<=5)

          lr_end_transaction("Ping_Tempo",LR_PASS);

else

 

          lr_end_transaction("Ping_Tempo",LR_FAIL);


    return 0;

View solution in original post

0 Likes
Highlighted
Established Member..
Established Member..

Re: saving duration as a parameter in a vugen script

Jump to solution

your code wont work because you have not ended the timer. lr_end_timer.

Pavankumar
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: saving duration as a parameter in a vugen script

Jump to solution

Thanks very much it worked 🙂

0 Likes
Highlighted
Established Member..
Established Member..

Re: saving duration as a parameter in a vugen script

Jump to solution

cool. can you mark my answer as solved?

Pavankumar
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.