Is this bug in LoadRunner 9.52 with lr_end_timer ?- No Please

29 Apr

I have a business process which needs to be scripted with LoadRunner and business process looks some thing like below like below.

  1. The users logs in to the web application.
  2. Then he adds some details in the next screen which comes right after login.
  3. After adding details users click on search button.
  4. After clicking on search button, results are displayed in the data grid.
  5. Max 10 records per page are displayed in the grid.
  6. Then user’s clicks on the first record and details about that record are displayed in the new browser window.
  7. In this new browser window, there exists little or some transaction information.
  8. User needs to find out as how many transaction records exist. It’s more like of viewing details.
  9. If transaction details are less than 500, then he needs to display the response time for those 500 records without writing a transaction for it.
  10. If the transaction details are more than 500, he needs to insert transaction marker and measure the response time.

Well here is some more information about this application, its classic web enterprise application. Not much technical complexity involved while scripting with LoadRunner nor the business process is very much complicated.

However this application has lot of data dependency and one needs to have right dataset in place. Now since this application is part of large program and this application belongs one of the top tier client, getting the right data set for this application is hard job. Of course there exists a data team which gives us the data in millions, but again they don’t assure that data is valid or its good data.

So basically for point 4, for some user ids, you might get no records found or 10’s of records. Similarly for point number 8, we can have 2 records or 3000 records. However we need to ensure that we are giving transaction response time for those transactions which has got more than 500 records for point 10.Looks some simple right. But for some reasons, LoadRunner is not allowing me do the job.

So here is my script for doing this,

long double time_getorderdetails ;

merc_timer_handle_t timer;

merc_timer_handle_t lr_start_timer ();

double lr_end_timer (merc_timer_handle_t timer_handle);

timer =  lr_start_timer();

// I have still more code on top of this,however that are web calls irrelevant to problem









// this block of If then will exist the iteration in case 0 search results are found for point 3

if (atoi (lr_eval_string (“{orderDetails_count}”))==0){

  lr_output_message (“—->the OrderDetails Count is Zero”);




for (m=1; m<=atoi (lr_eval_string(“{orderDetails_count}”) );m++) {

// If search results are displayed, then I click sequentially each // record displayed in the search with below for loop order details count

// is captured earlier with web reg save param.


itoa(m, i,10);

lr_save_string(i,”random” );

paramvalue = lr_eval_string( lr_eval_string(“{orderDetails_{random}}”) );

lr_save_string( paramvalue, “random_param” );

lr_output_message (“The value of the random_param #%s”, lr_eval_string (“{random_param}”));

// Text check to ensure that when I click the record, I am viewing transactions.

web_reg_find(“Text=** END OF ACTIVITY **”,  LAST);

// I capture all the transactions with web reg save param,









// this is url which gives you to view transaction details as mentioned in point 8,9,10










time_getorderdetails = lr_end_timer(timer);

lr_output_message (“Transaction Duration for order details call is %0.01f”, time_getorderdetails);

lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG, LR_SWITCH_ON);

if (atoi(lr_eval_string(“{TransactionCheck_count}”))> 500)


lr_output_message(“The value of the random_param #%s”, lr_eval_string(“{random_param}”));

lr_output_message(“The number of transaction were GREATER than 500 #%0.01f”, lr_eval_string(“{TransactionCheck_count


// I set this transaction to pass in case if transaction records are more than 500


              lr_output_message (“Transaction Duration for transactions more than 500 is %0.01f”, time_getorderdetails);




            lr_output_message(“The number of transactions were LESS than 500 #%s”, lr_eval_string(“{TransactionCheck_count}”));

            lr_output_message(“The value of the random_param #%s”, lr_eval_string(“{random_param}”));

             lr_output_message(“Transaction Duration for transaction less than 500 were %1f”, time_getorderdetails);


        lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG, LR_SWITCH_OFF);

So I have above code, which works perfectly when I don’t give lr_start_timer and lr_end_timer.But when I give these 2 functions and try to use that with lr_set_transaction,I get below message in vugen logs,

First time loop value is Transaction Duration for order details call is 1.346211

Second time loop value is Transaction Duration for order details call is 2.582253

Third time loop value is Transaction Duration for order details call is 1304018620.981333

Fourth time loop value is Transaction Duration for  more than 500 is 1304018623.736548

All these above values are part of for loop which I have built for checking all the orders sequentially in the above code. If you look at the values at 1st time and 2st time, they are in seconds as it should be for lr_start_timer and lr_end_timers.If you look at values in 3rd and 4th, they are indeed response time but they are response time since 1st Jan 1970.

Yes I haven’t added anything great in the code, it’s all there in help files of LoadRunner which comes bundled with LoadRunner installation.

I have time_getorderdetails variable declared as double data type. So I believed that value returned will have some precision, but again the precision what LoadRunner was giving me was driving me nuts.

Also after couple of more minutes of test run in vugen and pc, I get below errors,

Error: C interpreter run time error: TransactionCheck.c (372):  Error — memory violation : Exception ACCESS_VIOLATION received.

TransactionCheck.c(372): Notify: CCI trace: TransactionCheck.c(372): lr_end_timer(0x024e4cf8 “”)


TransactionCheck.c(372): Notify: CCI trace: Compiled_code(0): TransactionCheck()

Well it was quite disappointing to know that when LoadRunner has made so many improvements ,added so many protocols yet it does not have a function which can suspend the transaction at runtime and not write about that event in the test reports or test results file. Flexibility to create transaction without markers in the first place is need which I feel needs to be addressed in this ajaxified world. None of functions available in LoadRunner gives you an option to create a transaction without using lr_start_transaction in the first place other than lr_set_transaction and there isn’t any easy option to put timers and get values of it.I tried but for some reason got response time since 1/1/1970 which I am sure my stakeholders are not interested. Debugging this code for business process isn’t a hard job but again, when we have perfect response time twice and there after response time in Unix style, this complicates the matter further as I need to add some more c code to this and then do some comparison et etc. For various reasons, I believe performance testing scripts should be lean in code.

With this I strongly believe this could be a major bug in lr_start_timer and lr_end_timer functions.

Hope code and other details aren’t hard to read.

Well the version of LoadRunner used was 9.52 and PC version was also the same.

Latest Update as of 30th April.

Well the issue has been resolved and the problem was that I was dealing with unreachable code. The code given above is right code and it does all the things what it is supposed to do.However there is one silly error  which makes the code unreachable.I will not add the corrected stuff here and would request readers to find out the silly error.With this I am editing the title of the post.My apologies to LoadRunner team for calling this as Bug.



Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: