The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:




Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Testing Tools >> HP Functional Testing / Mercury QuickTest Pro / QTP

Pages: 1
Milton70
Newbie


Reged: 11/28/06
Posts: 15
Exit test from within overridden function
      #605217 - 12/09/09 08:38 AM

Hi Folks,

I've overridden a number of the standard methods (Set, Select etc.) and get the overridden methods to carry out exists and enabled checks along with error trapping and a few other things.

When I encounter an error or the object doesn't exist, I want to exit the component (in BPT) or exit the test in normal QTP. However, none of the exit statements other than Exit Function appear to work.

Any Ideas?

Thanks


Post Extras: Print Post   Remind Me!   Notify Moderator  
ambience
Member


Reged: 06/18/07
Posts: 374
Loc: Toronto, Canada
Re: Exit test from within overridden function [Re: Milton70]
      #605266 - 12/09/09 01:00 PM

Did you try ExitTest

Post Extras: Print Post   Remind Me!   Notify Moderator  
Milton70
Newbie


Reged: 11/28/06
Posts: 15
Re: Exit test from within overridden function [Re: ambience]
      #605340 - 12/10/09 12:51 AM

Yes, have tried all the exit statements including ExitRun which is depreciated. If I have error trapping on (On Error Resume Next), it just skips the exit statement back to the calling function, with error trapping off it throws a 'General Error' run-time pop up.

I want to deal with the error inside the override function, I can send a fail return code back to the original statement but this means I then have to have conditional statements around the method or check a global variable. I wanted the original method and the override method to be the same with no further coding being required by other automation engineers using the overridden methods.

Anyone know of how I can stop the execution other than the Exit statements that don't appear to work?

I don't want to resort to Recovery scenarios (which are evil!).

Thanks

Milton


Post Extras: Print Post   Remind Me!   Notify Moderator  
artemkv
Member


Reged: 04/05/07
Posts: 127
Re: Exit test from within overridden function [Re: Milton70]
      #605499 - 12/10/09 01:04 PM

looks like a scope issue,
did you use RegisterUserFunc for overriding?

ExitTest worked on my machine.
is your function attached to associated resources thru executefile?

can also try ExecuteGlobal "ExitTest"

--------------------
QA automation


Post Extras: Print Post   Remind Me!   Notify Moderator  
Milton70
Newbie


Reged: 11/28/06
Posts: 15
Re: Exit test from within overridden function [Re: artemkv]
      #605648 - 12/11/09 07:29 AM

Yes, I'm using RegisterUserFunc and I've tried ExecuteGlobal with no luck!

Further digging has highlighed the following:

If I run this through a standard QTP test with associated function library, the Exit statements work fine. If however, I convert it all to BPT components, the Exit statements stop working within the overridden methods. So, I'm stuck.

Let me know if you want to see the code.

Thanks


Post Extras: Print Post   Remind Me!   Notify Moderator  
Tarun LalwaniModerator
Veteran


Reged: 07/21/05
Posts: 15329
Loc: Milwaukee, Wisconsin
Re: Exit test from within overridden function [Re: Milton70]
      #605704 - 12/11/09 06:50 PM

We usually use ExitComponent and all are components are set to onFailure exit in the BP. So that works well for us

--------------------
Regards,
Tarun
** First ever technical novel - And I thought I knew QTP! **
** Download QTP Unplugged 2nd Edition eBook for FREE **

KnowledgeInbox RSS


Post Extras: Print Post   Remind Me!   Notify Moderator  
Milton70
Newbie


Reged: 11/28/06
Posts: 15
Re: Exit test from within overridden function [Re: Tarun Lalwani]
      #605880 - 12/14/09 05:09 AM

But that's just my problem; I want to use ExitComponent, it works on the driving function library and the driving test but doesn't work 'inside' the override function using RegisterUserFunc.

I want my automation engineers (who are relatively immature in test automation terms) to be able to script using the standard methods which I've overridden, so that my error handling and synchronisation routines are automatically triggered.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Tarun LalwaniModerator
Veteran


Reged: 07/21/05
Posts: 15329
Loc: Milwaukee, Wisconsin
Re: Exit test from within overridden function [Re: Milton70]
      #605882 - 12/14/09 05:13 AM

It works for me.

--------------------
Regards,
Tarun
** First ever technical novel - And I thought I knew QTP! **
** Download QTP Unplugged 2nd Edition eBook for FREE **

KnowledgeInbox RSS


Post Extras: Print Post   Remind Me!   Notify Moderator  
Milton70
Newbie


Reged: 11/28/06
Posts: 15
Re: Exit test from within overridden function [Re: Tarun Lalwani]
      #605898 - 12/14/09 06:40 AM

OK, so what have you done that I haven't?

I've got a common function library with the RegisterUserFunc statements and the override function code. I've also got an application function library that contains the code for the BPT components.

Here's an example; I've overridden the WinEdit Set method and it is called in the application function library. If the text box is non-editable, the set method fails and a runtime error is returned. I trap the error and want to then exit the component but I'm in the override function when I trap the error and for whatever reason, the ExitComponent statement doesn't work. If I place On Error GoTo 0 before the ExitComponent statement then it returns me to the calling application function library but then creates a runtime error here.

Thanks


Post Extras: Print Post   Remind Me!   Notify Moderator  
Tarun LalwaniModerator
Veteran


Reged: 07/21/05
Posts: 15329
Loc: Milwaukee, Wisconsin
Re: Exit test from within overridden function [Re: Milton70]
      #605905 - 12/14/09 07:00 AM

Well I do it in this way usually
Code:

Function SetValue(obj, Text)
If objectExist(obj) Then
obj.Set Text
Else
ExitComponent
End If
End function

RegisterUserFunc "WebEdit", "SetValue", "SetValue"



--------------------
Regards,
Tarun
** First ever technical novel - And I thought I knew QTP! **
** Download QTP Unplugged 2nd Edition eBook for FREE **

KnowledgeInbox RSS


Post Extras: Print Post   Remind Me!   Notify Moderator  
Milton70
Newbie


Reged: 11/28/06
Posts: 15
Re: Exit test from within overridden function [Re: Tarun Lalwani]
      #605920 - 12/14/09 07:51 AM

Exactly what I do but when I hit the ExitComponent statement, it just returns to the statement that has the overridden method and unless I'm error trapping will create a runtime error.

Does yours break out back to the calling statement or to the next component?


Post Extras: Print Post   Remind Me!   Notify Moderator  
Tarun LalwaniModerator
Veteran


Reged: 07/21/05
Posts: 15329
Loc: Milwaukee, Wisconsin
Re: Exit test from within overridden function [Re: Milton70]
      #605928 - 12/14/09 08:24 AM

Mine goes to the next component. But I don't have any error handlers at all. I let the errors to be raised so that component stops

--------------------
Regards,
Tarun
** First ever technical novel - And I thought I knew QTP! **
** Download QTP Unplugged 2nd Edition eBook for FREE **

KnowledgeInbox RSS


Post Extras: Print Post   Remind Me!   Notify Moderator  
Milton70
Newbie


Reged: 11/28/06
Posts: 15
Re: Exit test from within overridden function [Re: Tarun Lalwani]
      #605931 - 12/14/09 08:28 AM

Umm...Methinks a call to HP is likely!

Thanks for your help folks.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Paresh_Patel
Newbie


Reged: 09/13/11
Posts: 2
Re: Exit test from within overridden function [Re: Milton70]
      #698520 - 02/15/12 01:40 AM

I am facing same issue on QTP 11 too !

I know this thread seems old ...but would be happy if I get any updates on this issue.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 96 anonymous users are browsing this forum.

Moderator:  IanFraser, Rajkumar_Rajangam, thorwath, TReddy, AJ, Tarun Lalwani, mwsrosso 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 4663

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5