Forcing a transaction to pass

333 views
Skip to first unread message

Jim

unread,
Aug 20, 2009, 6:13:08 AM8/20/09
to LoadRunner
Does anyone know if it is possible to force a transation to pass
rather than to error?

I am testing a reporting part of a system where while a query is
running a holding page comes up, this holding page has a link on it to
refresh the page. I have created a while loop to click this link and
while it is successful continue looping around and as soon as it fails
I know that the query has completed and I can go on to perform a
web_reg_find to make sure I am now on the screen I expect to be. This
is what I am using so far :

click_link_while ()

{
int c_counter = 0;
int status = 0;

//Turn on Continue on error
lr_continue_on_error( 1 );

//Stay in while loop when the status is success.
while ( status == 0 )

{
//Increment counter by 1
c_counter ++;

//If to break out of loop when the query runs for too long.
if (c_counter > 1200)
{
lr_error_message("Query running for longer than 20 mins");
lr_exit( LR_EXIT_ACTION_AND_CONTINUE,
LR_FAIL );
}

//Think time to delay the loop.
lr_think_time(1);

//Click the link to manually refresh the page and get the
//status of this. Status of 0 = success, 1 = failure.
status=web_link("click here.",
"Text=click here.",
"Snapshot=t7.inf",
LAST);
}

//Turn off Continue on error.
lr_continue_on_error( 0 );

return(0);
}


This bit of code does allow me to perform the tests I need, but
because of the way I am doing it I always get a failed transaction so
every set of results I get has a failure and I have to investigate to
check that it is the one that I expect to get.

Is there anyway that I can force this particular transaction to passed
rather than erroring or perhaps ignore this transaction all together?
Or is there a better way for me to code this?

Thanks,

Jim

pablo martinez

unread,
Aug 20, 2009, 12:13:13 PM8/20/09
to LR-Loa...@googlegroups.com
did you try with LR_PASS instead using LR_AUTO or LR_FAIL ?

poonam priyadarshi

unread,
Aug 20, 2009, 2:35:17 PM8/20/09
to LR-Loa...@googlegroups.com
Try changing the code to
 
 lr_exit( LR_EXIT_ACTION_AND_CONTINUE,
                                        LR_PASS);
 
Since you have error messge ,it will displya in error but the transaction will be in PASS STATE.



 
On Thu, Aug 20, 2009 at 6:13 AM, Jim <jksmi...@gmail.com> wrote:

Jim

unread,
Aug 25, 2009, 9:43:39 AM8/25/09
to LoadRunner
Sorry but I don't think I made the question very clear in the first
place. I don't want the transaction to pass if it meets the timeout
condition, rather I want it to pass every time on this bit

//Click the link to manually refresh the page and get
the
//status of this. Status of 0 = success, 1 =
failure.
status=web_link("click here.",
"Text=click here.",
"Snapshot=t7.inf",
LAST);

regardless of whether the web_link is successfull or not. I have
tried sticking in an LR_PASS in this bit but it didn't seem to make
any difference.

On Aug 20, 7:35 pm, poonam priyadarshi <poonam.priyadar...@gmail.com>
wrote:
> > Jim- Hide quoted text -
>
> - Show quoted text -

Abhishek Banginwar

unread,
Aug 25, 2009, 11:03:29 AM8/25/09
to LR-Loa...@googlegroups.com
Jim,
Only Way your loop exits is when it exceeds 20 mins of refreshing your page or when Status changes to 1.
I tried searching if web_link returns any value. i was not able to find any example or syntax specifying the same.
can you please do the following?
  1. Using lr_vuser_status_message or lr_message, print the value of status variable.
  2. change web_link to web_url, if you get proper response in status variable

Abhishek
--
Abhishek

Jim

unread,
Aug 25, 2009, 11:28:51 AM8/25/09
to LoadRunner
I have added in the lr_output_message as you suggested and get this :

//Click the link to manually refresh the page and get the
//status of this. Status of 0 = success, 1 = failure.
status=web_link("click here.",
"Text=click here.",
"Snapshot=t7.inf",
LAST);

lr_output_message("The value of Status is %i",status);

The value of Status is 0
The value of Status is 0
The value of Status is 0
The value of Status is 0
The value of Status is 0
The value of Status is 0
The value of Status is 0
The value of Status is 0
The value of Status is 0
The value of Status is 1


On Aug 25, 4:03 pm, Abhishek Banginwar <abhishek.bangin...@gmail.com>
wrote:
> Jim,
> Only Way your loop exits is when it exceeds 20 mins of refreshing your page
> or when Status changes to 1.
> I tried searching if web_link returns any value. i was not able to find any
> example or syntax specifying the same.
> can you please do the following?
>
>    1. Using lr_vuser_status_message or lr_message, print the value of status
>    variable.
>    2. change web_link to web_url, if you get proper response in status
> Abhishek- Hide quoted text -

John Crunk

unread,
Aug 25, 2009, 10:00:20 PM8/25/09
to LR-Loa...@googlegroups.com
Looks to me like this failed 9 times and passed once. With those odds you
want to make it pass instead of finding out why it is not working?

John

Jim

unread,
Aug 26, 2009, 3:26:40 AM8/26/09
to LoadRunner
Actually a status of 0 in this case is a pass and a 1 is a failure -
so this has failed once on the final iteration. I know why it is
failing - the link is no longer on the page as the query has finished
and the report is now ready to be viewed. If anyone can suggest a
better way for me to code this I'm more tha happy to scrap what I am
using at the moment.

Jim
> > - Show quoted text -- Hide quoted text -

jpu...@itestsolutions.com

unread,
Aug 26, 2009, 1:55:55 PM8/26/09
to LR-Loa...@googlegroups.com
Web_reg_find()
-----Original Message-----
From: Jim <jksmi...@gmail.com>

Date: Wed, 26 Aug 2009 00:26:40
To: LoadRunner<LR-Loa...@googlegroups.com>

Jim

unread,
Aug 27, 2009, 3:20:44 AM8/27/09
to LoadRunner
Using a web_reg_find() wouldn't change the fact that I would still
have a transaction that is failing, I'd just have a web_reg_find
failing instead of a web_link.

jpu...@itestsolutions.com

unread,
Aug 27, 2009, 6:03:58 AM8/27/09
to LR-Loa...@googlegroups.com
Make your condition based on whether certain content is present on the page, hence web_reg_find().
-----Original Message-----
From: Jim <jksmi...@gmail.com>

Date: Thu, 27 Aug 2009 00:20:44
Reply all
Reply to author
Forward
0 new messages