Dynamic text check

857 views
Skip to first unread message

UI

unread,
Jan 20, 2011, 10:45:57 AM1/20/11
to LoadRunner
Hi
I'm new here also to LR. so i need your kind help about my problem.
I want to insert a text check to verify the value being passed from
previous page is correct or not(I'm using Flight reservation website
which is provided as sample with LR). for this on the page of find
flight, select random cities ad departure and arrival and select next
here insert text check on text string "Flight departing from Frankfurt
to London on 01/21/2011" and complete the recoding .
after that replace them with parameters but this script generate
error.
please view this section of script


//text check
web_reg_find("Search=All","Text={arrive}</b> to
<b>Text={depart}",LAST);

// printing value in log
lr_output_message("hi this is values :%s %s",
lr_eval_string( "{arrive}"),lr_eval_string("{depart}"));

// main transaction with parameter of place and date
web_submit_data("reservations.pl",
"Action=http://127.0.0.1:1080/WebTours/reservations.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/reservations.pl?
page=welcome",
"Snapshot=t4.inf",
"Mode=HTML",
ITEMDATA,
"Name=advanceDiscount", "Value=0", ENDITEM,
"Name=depart", "Value={depart}", ENDITEM,
"Name=departDate", "Value={departDate}", ENDITEM,
"Name=arrive", "Value={arrive}", ENDITEM,
"Name=returnDate", "Value={returnDate}", ENDITEM,
"Name=numPassengers", "Value={numPassengers}", ENDITEM,
"Name=seatPref", "Value=Window", ENDITEM,
"Name=seatType", "Value=Business", ENDITEM,
"Name=.cgifields", "Value=roundtrip", ENDITEM,
"Name=.cgifields", "Value=seatType", ENDITEM,
"Name=.cgifields", "Value=seatPref", ENDITEM,
"Name=findFlights.x", "Value=64", ENDITEM,
"Name=findFlights.y", "Value=2", ENDITEM,
LAST);


please suggests me best way to handle this.



prasenjit dutta

unread,
Jan 21, 2011, 6:20:06 AM1/21/11
to lr-loa...@googlegroups.com
What are these {arrive} and {depart}?? If these are parameters then why r u printing those values??? and secondly u r only printing those values but not saving it to any other variables and directly replacing the same parameter in the codes...so i am not able to understand what u actually wanted to do here???
 
Checkout ur date(returnDate and departDate) parameters.....did u converted those parameters in to the date of the same format while generated during recording???
 
Thanks,
Prasenjit




--
You received this message because you are subscribed to the Google "LoadRunner" group.
To post to this group, send email to LR-Loa...@googlegroups.com
To unsubscribe from this group, send email to
LR-LoadRunne...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/LR-LoadRunner?hl=en



--
Prasenjit

isha isha

unread,
Jan 21, 2011, 2:54:32 AM1/21/11
to lr-loa...@googlegroups.com
Hi ,
 
You can use Web_reg_find function to handle this.
Web_reg_find function search for the parameter you pass in the function and check it on the web page.,
so while recording after you complete the transaction and you are on that particular page , you can use this function to search the parameter.

 
On Thu, Jan 20, 2011 at 9:15 PM, UI <umarifti...@gmail.com> wrote:

Vin

unread,
Jan 21, 2011, 9:42:11 AM1/21/11
to LoadRunner
Can you elaborate how to use web_reg_find with use of SaveCount
attribute? Also can u tell me how to save that parameter value in some
variable?

Thanks in advance.
> > LR-LoadRunne...@googlegroups.com<LR-LoadRunner%2Bunsubscribe@goog legroups.com>

Vin

unread,
Jan 21, 2011, 9:49:16 AM1/21/11
to LoadRunner
Please find the script for web_reg_find in my case,

web_reg_find("Text=Corresponding list", "SaveCount=Duplicat_Count",
LAST);
lr_output_message("The value of SaveCount is
%s",lr_eval_string("{Duplicate_Count}"));

If i am able to run above script with no error. But i do have a
warning in Replay log

Registering web_reg_find was successful [MsgId: MMSG-26390]
Warning: The string 'Duplicatedonor_Count' with parameter delimiters
is not a parameter.
The value of SaveCount is {Duplicatedonor_Count}
Warning: The string 'Duplicatedonor_Count' with parameter delimiters
is not a parameter.

can you tell me what i am missing here?


On Jan 21, 2:54 am, isha isha <ekish...@gmail.com> wrote:
> > LR-LoadRunne...@googlegroups.com<LR-LoadRunner%2Bunsubscribe@goog legroups.com>

James Pulley

unread,
Jan 21, 2011, 10:08:03 AM1/21/11
to lr-loa...@googlegroups.com
Great question.

1. Go to your LoadRunner web virtual user training manual.
2. Turn to the section on the use of web_reg_find().
3. Review the class discussion material and lab material.

You will find your exact question and use is covered.

James Pulley, http://www.loadrunnerbythehour.com/PricingMatrix

Viral Patel

unread,
Jan 21, 2011, 10:26:41 AM1/21/11
to lr-loa...@googlegroups.com
Thanks James, If i can find/able to understand from training manual by myself than i wouldn't post question here. I guess i am capable enough to find answer from reference material myself.

Anyways thanks for you time. I know u always want people to either get mentor or training, but person/organization are also trying to save money.  

Venkat P

unread,
Jan 21, 2011, 10:42:42 AM1/21/11
to lr-loa...@googlegroups.com
Viral,

"If i can find/able to understand from training manual by myself than i wouldn't post question here. I guess i am capable enough to find answer from reference material myself."

Its a simple task to do the above - Are you saying that you 1)couldnt find it 2) found it but didnt understand it 3) dont want to do it at all?

It has been a continuing request from everyone on this group to newbies to check the documentation first - if you found it and didnt understand it then state the same at the begining of the email " I looked up the documentation and did not understand it / did not find it" atleast we know you made the effort.

If you didnt find it then go to
C:\Program Files\HP\LoadRunner\bin\FuncRef.chm 
Search for web_reg_find, look up the options.

Now let us know if you didnt understand it.

-Venkat

Venkat P

unread,
Jan 21, 2011, 10:56:32 AM1/21/11
to lr-loa...@googlegroups.com
1.  Take your time in typing the code. doublecheck your variables - check what you are creating, what you are trying to call. ensure they are the same.

2.  Learn interpretation of the Vuser Log - if it says    string XXXX is not a parameter - then it means what it says. you need to figure why is it that string XXXX is not a parameter..

3. Your code snippet has typo errors at two different levels - suggesting two people put it together. If it has been put together by only one person - then refer to (1) above

Sorry, am in a gruff mood today

-Venkat

James Pulley

unread,
Jan 21, 2011, 11:14:29 AM1/21/11
to lr-loa...@googlegroups.com

There is a well known and defined return on investment from training in LoadRunner.   At the absolute minimum the difference between a trained and untrained person is an untrained person is only 20% as efficient as a trained one.   And this assumes that core skills are in place.   If you have a person who is weak in some core skills related to code development, testing, planning, analysis then you are looking at efficiencies dropping into the 5-10% range.   Even less with some of the more exotic protocols.   This efficiency hit acts as a thief against the budget for the test efforts, stealing resources from the effort and even from the mission of the company.

 

As I drove in this morning I was speaking with a colleague about an incident that occurred in California.  Mid last year a large multinational firm  had a pretty severe performance problem with an application and a colleague was asked to take a look at this issue.   Within a couple of hours a hypothesis was in place that the cause was a memory leak and that this person would need access to some tools to validate the error.   Well, this person is pricey compared to most in the market, but the skills and knowledge are worthy of the rate.  The client supply chain yanked on the short hairs of the project managers not to pay that rate.   So instead this company went through a large performance test effort with inexpensive and ineffective resources who were not able to even come to a hypothesis about the source of the performance problem.   Fast forward six months to December and after a couple of hundred thousand dollars had been expended on the performance test effort the same colleague was once again asked to take a look.   Two days later the problem was pinned down.  It was a memory leak in the areas covered by the original hypothesis dating back some six months.    Now, this colleague does have a price and that price is in the range of 5x what the other performance team individual members were charging.   The supply chain didn’t bat an eye at the hour upon hour of inexpensive labor, but questioned even an hour or two of the higher rate.   The cost  for the more expensive resource to pin down the issue? Around 1% of the total cost of the team of less expensive resources.   The opportunity cost of six months of ineffective performance testers hunting in the dark for a light switch likely can never be recovered.  

 

The supply chain at many companies has forgotten the core issue of value, which is distinct from price.  In the absence of a standardized industry credential to act as a discriminator of quality they lump all providers together in a commodity view.   This perspective costs organizations severely every single day when it comes to performance test efforts as well as automated functional test efforts.

 

It's unwise to pay too much, but it's worse to pay too little. When you pay too much, you lose a little money -- that is all. When you pay too little, you sometimes lose everything, because the thing you bought was incapable of doing the thing it was bought to do. The common law of business balance prohibits paying a little and getting a lot -- it can't be done. If you deal with the lowest bidder, it is well to add something for the risk you run, and if you do that you will have enough to pay for something better.” John Ruskin, The Common Law of Business Balance

 

Training is the first step on the path to success in any discipline: Being a performance tester is no different.  If your management at the Red Cross is unwilling to follow a path of training and mentoring in this discipline which results in a high quality and high value deliverable then they are disinterested in success in this endeavor and they would be well served to simply abandon the performance test practice.   A bad performance test is worse than no test at all for it creates false impressions about the scalability and performance of a system which are used to set users expectations.  Poor quality tests will spawn engineering ghosts that development will spend sparse dollars chasing.    Core tasks will take significantly longer to accomplish, taking scarce funds from the core mission of the company.  Food for a disaster victim for a day or one more hour of script development?  That’s easy, if the testing effort is of challenging quality then save the money for food and shelter for the disaster victims.

 

James Pulley, http://www.loadrunnerbythehour.com/PricingMatrix

Would you hand an untrained person a firearm and tell them to “just figure it out?”  Would you engage in the same behavior with a potentially very destructive performance test tool?  Why or why not?

Viral Patel

unread,
Jan 21, 2011, 10:54:12 AM1/21/11
to lr-loa...@googlegroups.com
Hi Venkat,

I checked Function Reference Library- i saw description & example. I read VUGen user guide manual too. From what i have read and googled i wrote the script i posted but i had some errors running it so i asked foe help. 

I wouldn't say i understood everything what i read but i understand the concept/function, why we are using it. Hope that make sense to you.

I dont know if you have noticed it or not but i saw James is more than 100% active in LR group what i appreciate a lot. I saw his Linkedin Profile and he has very pro found knowledge in LR for years and years. Apparently he runs company, take the projects, provide paid mentoring too. He is also moderator of SQA Forum too. Honestly that comment i made was for him only.

And i will be careful next time to post that i looked up so and so reference materials. Hope this clears the confusion. Thanks for the reply and help.

Thanks,
Viral

Stimely, Noelle

unread,
Jan 21, 2011, 12:47:25 PM1/21/11
to lr-loa...@googlegroups.com

Very well put, James!

 

Noelle

Ruslan Kholyavkin

unread,
Jan 20, 2011, 1:18:51 PM1/20/11
to lr-loa...@googlegroups.com

//////////////////  Set Verification Key Word for Each Page ///////////////

startTransaction (LR_PARAM _keyWords ,LR_PARAM _transactionName) {

 lr_save_string (_keyWords,"_keyWords");
 lr_save_string (_transactionName,"_transactionName");

  // Verification
  web_reg_find("Text={_keyWords}",

       "SaveCount=Welcome_Count",

                 LAST);

   // Positive verification for Json call if there is no data


  // web_reg_find("Text=personId",

         // "SaveCount=personId_Count",
                               // LAST);

      //
   web_reg_find ("Text=numFound",
           "SaveCount=personId_Count",
                               LAST);

  //  Negative Verification

 web_reg_find("Text=Our Apologies",

         "SaveCount=Error",

                              LAST);

     //  Negative Verification 1

     web_reg_find ("Text=There are no columns",
                   "SaveCount=Error1",
                               LAST);
     // Negative Verification 2

     web_reg_find ("Text=The data in this form has been changed ",
                    "SaveCount=Error2",
                              LAST);
     web_reg_find ("Text=Exception",
                   "SaveCount=Error3",
                              LAST);

     web_reg_find ("Text=This action is no longer available",
                     "SaveCount=Error4",
                                 LAST);


    lr_start_transaction (lr_eval_string("{_transactionName}"));


}
 
endTransaction (LR_PARAM _transactionName ) {
    lr_save_string (_transactionName,"_transactionName");

     if ((atoi(lr_eval_string("{Welcome_Count}")) == 0) && (atoi( lr_eval_string("{personId_Count}")) == 0) )  {
              lr_error_message("Transaction:   %s   - failed " ,lr_eval_string("{_transactionName}"));
              // enable for Debug Reson Only
              //lr_error_message("Search key word - %s " ,lr_eval_string("{Welcome_Count}"));
              //lr_error_message("Defautl key words - %s " ,lr_eval_string("{personId_Count}"));
              lr_error_message("numFound_Count - %s " ,lr_eval_string("{personId_Count}"));
          }
     // Check Result for Negative
  if (atoi(lr_eval_string("{Error}")) > 0){
               lr_error_message("Transaction:  %s   - failed " ,lr_eval_string("{_transactionName}"));
            }
  if (atoi(lr_eval_string("{Error1}")) > 0){
               lr_error_message("Transaction:  %s   - failed " ,lr_eval_string("{_transactionName}"));
            }
  if (atoi(lr_eval_string("{Error2}")) > 0 ){
                        lr_error_message("Transaction:   %s   - failed " ,lr_eval_string("{_transactionName}"));
                              }
       if (atoi(lr_eval_string("{Error3}")) > 0 ){
                        lr_error_message("Transaction:   %s   - failed " ,lr_eval_string("{_transactionName}"));
                              }

       if (atoi(lr_eval_string("{Error4}")) > 0 ){
                            lr_error_message("Transaction:   %s   - failed " ,lr_eval_string("{_transactionName}"));
                              }
  // Return Transaction Status Pass or Fail
  if (((atoi(lr_eval_string("{Welcome_Count}")) == 0) && (atoi( lr_eval_string("{personId_Count}")) == 0) )        || (atoi(lr_eval_string("{Error}")) > 0) || (atoi(lr_eval_string("{Error1}")) > 0) || (atoi(lr_eval_string("{Error2}")) > 0)  || (atoi(lr_eval_string("{Error3}")) > 0) || (atoi(lr_eval_string("{Error4}")) > 0)) {
                 lr_end_transaction (lr_eval_string("{_transactionName}"),LR_FAIL);
                   }
  else   {
              lr_end_transaction (lr_eval_string("{_transactionName}"),LR_PASS);
          }
}

Viral Patel

unread,
Jan 21, 2011, 11:06:29 AM1/21/11
to lr-loa...@googlegroups.com
No Problem, thanks for reply.

Here is code again, i figured there was "e" missing in previous code.
I got the script running and i am getting desired output but i still have Warning in Replay log.

web_reg_find("Text=Corresponding list", "SaveCount=Duplicate_Count",
                                LAST);
       lr_output_message("The value of SaveCount is
%s",lr_eval_string("{Duplicate_Count}"));


Action.c(656): web_reg_find started   [MsgId: MMSG-26355]
Action.c(656): Registering web_reg_find was successful   [MsgId: MMSG-26390]
Action.c(658): Warning: The string 'Duplicatedonor_Count' with parameter delimiters is not a parameter.
Action.c(658): The value of SaveCount is {Duplicatedonor_Count}

Any input on this?

Eby

unread,
Jan 24, 2011, 8:21:32 AM1/24/11
to LoadRunner
That error is because you placed the line of code
" lr_output_message("The value of SaveCount is
%s",lr_eval_string("{Duplicate_Count}")); "

before the web_submit_data("reservations.pl", blah blah,LAST);"
request..

now place the lr_output_message() after/below the web_submit_data
function, your warning will go off and it would print what you wanted
to.

-Eby J
> >http://groups.google.com/group/LR-LoadRunner?hl=en- Hide quoted text -
>
> - Show quoted text -

Viral Patel

unread,
Feb 2, 2011, 1:52:23 PM2/2/11
to lr-loa...@googlegroups.com
Thanks for resolution. It is working now.
Reply all
Reply to author
Forward
0 new messages