Loading...

LR-LoadRunner@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: Problem in passing variable for text check Mahesh Kumar Somaraju Tue Jul 05 23:00:46 2011

Hi,

You can write web_reg_find as below to implement that.

web_reg_save_param("Check1",
              "LB=TN06 - ",
              "RB=T",
              "NotFound=WARNING",
              "Search=All",
              LAST);


web_reg_find(lr_eval_string("Text={Check1}"),
              "SaveCount=pg1_count",
              "Search=Body",
              LAST);

This will help you to dynamically validates the page response.

Hope this helps.


Regards,
Mahesh



On Wed, Jul 6, 2011 at 2:25 AM, piyush gupta <[EMAIL PROTECTED]>wrote:

> not sure but this might be a possible solution.....
> in web_reg_find "Text=" searches for a known string. TextPfx and
> TextSfx are used when the string is not known in advance, but you know
> what strings will precede and follow it.use SaveCount with it than
> matches count of web_reg_save_param,web_reg_find.if both equal than
> everything fine otherwise :)
>
>
>
> On 7/3/11, Ruslan Kholyavkin <[EMAIL PROTECTED]> wrote:
> > Two following  functions will do the job . Just update your validation
> > points for Negative ( Exceptions) and Pasitive   validation, which  need
> to
> > be match your application needs  . You can also edit ( add / remove
> > validation points ) but it need to be done in both functions.
> >
> > /*   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}"));
> >
> > }
> >
> >
> >
> > //////////////////////  VERIFY TRANSACTION BASED ON KEY WORDS///////////
> > 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);
> >           }
> > }
> >
> >
> > Example:
> >
> >> web_reg_save_param("Check1",
> >>                "LB=TN06 - ",
> >>                "RB=T",
> >>                "NotFound=WARNING",
> >>                "Search=All",
> >>                LAST);
> >
> >
> > startTransaction (lr_eval_string("{Check1}"), "TransactionName");
> >
> > /****************   Your HTTP Requestst   ********/
> >
> > endTransaction ( "TransactionName");
> >
> >
> > // I will recomend after paremeter check1 been usde  and  it doest not
> > needed until next iteration clean up  value of this parameter .
> >
> >
> > lr_save_string("","Check1");
> >
> >
> > I hope it is help
> > Thanks,
> > Ruslan
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Sun, Jul 3, 2011 at 1:40 AM, [EMAIL PROTECTED]
> > <[EMAIL PROTECTED]>wrote:
> >
> >> Hi James,
> >>
> >> I guess you're right. Is there any other way to accomplish this?
> >>
> >> On Jul 2, 7:41 pm, "James Pulley" <[EMAIL PROTECTED]>
> >> wrote:
> >> > If this is the exact sequence in your code, unbroken, then you will
> have
> >> a
> >> > web_reg_find() that cannot be satisfied due to the fact that {Check1}
> >> will
> >> > not have a value until after the page is loaded, while the
> registration
> >> of
> >> > the web_reg_find() will occur in advance of the page load.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > -----Original Message-----
> >> > From: [EMAIL PROTECTED] [mailto:
> >> [EMAIL PROTECTED]
> >> >
> >> > On Behalf Of [EMAIL PROTECTED]
> >> > Sent: Saturday, July 02, 2011 8:40 AM
> >> > To: LoadRunner
> >> > Subject: Problem in passing variable for text check
> >> >
> >> > Hi,
> >> >
> >> > I have a need to correlate a text value in the web page and pass the
> >> > saved string for a text check because the value needs to be checked
> >> > keeps changing everyday. So i just need to makesure the next page is
> >> > loading by inserting a text check for that correlated value. My code
> >> > looks like this
> >> >
> >> > web_reg_save_param("Check1",
> >> >                "LB=TN06 - ",
> >> >                "RB=T",
> >> >                "NotFound=WARNING",
> >> >                "Search=All",
> >> >                LAST);
> >> >
> >> >        web_reg_find("Text=lr_eval_string("{Check1}")",
> >> >                "SaveCount=pg1_count",
> >> >                "Search=Body",
> >> >                LAST);
> >> >
> >> > The error lies in this line "Text=lr_eval_string("{Check1}")", since
> >> > it checks for the text "lr_eval_string(" and not considering other
> >> > parts of the statement " {Check1}")" ". How to evade this?
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > "LoadRunner" group.
> >> > To post to this group, send email to [EMAIL PROTECTED]
> >> > To unsubscribe from this group, send email to
> >> > [EMAIL PROTECTED]
> >> > For more options, visit this group athttp://
> >> groups.google.com/group/LR-LoadRunner?hl=en
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> >> "LoadRunner" group.
> >> To post to this group, send email to [EMAIL PROTECTED]
> >> To unsubscribe from this group, send email to
> >> [EMAIL PROTECTED]
> >> For more options, visit this group at
> >> http://groups.google.com/group/LR-LoadRunner?hl=en
> >>
> >
> > --
> > You received this message because you are subscribed to the Google
> > "LoadRunner" group.
> > To post to this group, send email to [EMAIL PROTECTED]
> > To unsubscribe from this group, send email to
> > [EMAIL PROTECTED]
> > For more options, visit this group at
> > http://groups.google.com/group/LR-LoadRunner?hl=en
>
> --
> You received this message because you are subscribed to the Google
> "LoadRunner" group.
> To post to this group, send email to [EMAIL PROTECTED]
> To unsubscribe from this group, send email to
> [EMAIL PROTECTED]
> For more options, visit this group at
> http://groups.google.com/group/LR-LoadRunner?hl=en
>

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