SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 10 of 10
  1. #1
    Member
    Join Date
    Mar 2007
    Posts
    131
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Exit type functions (ExitTest, ExitRun...) do not always exit

    For over 8 years now I have not been able to get these functions to always exit immediately out of a test run when calling these functions.

    Framework background:
    I have 1 test case file that uses just 1 action.
    All my test cases are functions that are called in the 1 action.
    I have a Test_Function file that contains all my test cases.
    I have a Main_function file that is made up of functions that can only be used again my AUT.
    I have a Web_function file that contains functions registered (using RegisterUserFunc) so that they can be used as methods in any Web AUT (so I use SetUD instead of Set, Select, Click ect.)
    I have a GENERIC_function file that is made up of functions that do not manipulate any objects (so it has things like my own version of Reporter.Report Event, msgbox, string comparion ect.)

    So my test cases call functions defined in the Main, the Main calls functions defined in the Web, and the Web functions call functions defined in the Generic.
    If QTP cannot do a step sucessfully, or a verfication fales, a "Report" function is called.
    It calls a user defined msboxUD function that will display (by calling a msgbox) a popup stating the failed step (same message that the called Reporter.ReportEvent).
    The popup will also ask the user if he/she would like Continue running the test.
    If user choosed "NO", the ExitRun code is executed.


    I'm trying to figure out when it does and does not exit.
    If it does not exit, it will quickly display run-time errors for the next line or 2.
    It seems to always return a General error.
    It seems it will not immediately exit out if it still needs to execute registered functions that are imbedded in the root function being called in the Test Case function.

    On know "On Error Resume Next" will allow the test to run if used before the Exit, so I am not using that (but I tried it just to see what would happen).

    I think it is because I am using the functions as method (registering them) that causes QTP not to stop immediately.

    Anyone have any ideas??

    Thanks in advance!

    Peter

    PS

    Here are 2 of the error messages:

    General run error.
    Function file: Q:\QTP_Files\AUTs\DTS2\Function_Files\DTS2_Library File_Main.vbs
    Line (6166): " Verify_TitleServicesParameters_Msg_OrderHasBeenClo sed = Window("DTS").Page("DTS_TCA").Frame("TitleServices Parameters").WebElement("ORDER_HAS_BEEN_CLOSED").V erifyField_Sync("TRUE", "Exist", 0)".

    General run error.
    Function file: Q:\QTP_Files\AUTs\DTS2\Function_Files\DTS2_Library File_Main.vbs
    Line (6167): " Window("DTS").Page("DTS_TCA").CapturePopVerifyBitm ap sFunctionName".

  2. #2
    Member
    Join Date
    Mar 2007
    Posts
    131
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    I've narrowed it down to only methods causing the undesired behavior.

    So instead of using the function as a method, I use it as a regualr function:

    Method call:

    Window("DTS").Page("DTS_TCA").CapturePopVerifyBitm ap sFunctionName

    Non method call:

    Dim obj2
    Set obj2 = Window("DTS").Page("DTS_TCA").Frame("TitleServices Parameters").WebElement("ORDER_HAS_BEEN_CLOSED")
    CapturePopVerifyBitmap obj2, sFunctionName

    RegisterUserFunc can still be executed in the resource file and not cause any issues.

    But, I am not about to go through litterally tens of thousand of lines of code and modify it to work.

    Is there another function that can get QTP to really stop?

    (this forum adds spaces to my code - "Bitm ap" instead of "Bitmap")
    Last edited by PeterKlim; 02-03-2014 at 03:39 PM.

  3. #3
    SQA Knight bklabel1's Avatar
    Join Date
    Sep 2012
    Location
    Kew Gardens, United States
    Posts
    2,619
    Post Thanks / Like
    Blog Entries
    1
    Mentioned
    2 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    ExitTest not working is a known issue by HP. I have seen people on this board and on the openview site compaining about it a lot.

    I have not tried using UFT 11.5x to see if it is fixed. Has anyone tried in UFT?

    Thanks,

    Kevin

  4. #4
    SQA Knight bklabel1's Avatar
    Join Date
    Sep 2012
    Location
    Kew Gardens, United States
    Posts
    2,619
    Post Thanks / Like
    Blog Entries
    1
    Mentioned
    2 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    QTP 11. This is in a function library.

    Code:
    Function Halt()
    	On Error Resume Next
    	x = 3/0
    	Execute "ExitTest"
    	msgbox "still going"
    End Function
    I tried using Execute "ExitTest"

    It still does not work.

    Thanks,

    Kevin

  5. #5
    Advanced Member
    Join Date
    Mar 2007
    Location
    Salt Lake City, UT, USA
    Posts
    606
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    UFT 11.5 here.

    I took bklabel1's code and put it into a global functions library. Tried two versions, one with just ExecuteTest and one with Execute "ExitTest", neither of them stopped the test. However, without using a function library (just putting those functions directly at the end of the script that calls them), they work just fine.

    So, functions created in the same script where they are called will exit the test, but the same functions in a separate function library will not.
    "The last 10% of any software project will take 90% of the budgeted time. The first 90% will take the other 90%"

  6. #6
    Member
    Join Date
    Mar 2007
    Posts
    131
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Quote Originally Posted by bklabel1 View Post
    QTP 11. This is in a function library.

    Code:
    Function Halt()
    	On Error Resume Next
    	x = 3/0
    	Execute "ExitTest"
    	msgbox "still going"
    End Function
    I tried using Execute "ExitTest"

    It still does not work.

    Thanks,

    Kevin
    Thanks Kevin for your replies!

    On a side note, you look like a Kevin I met when taking an exam to become a WinRunner/TD CPI (I think in Mass).
    Then later we ended up working at Bowne in NJ.
    Hard to tell from your avitar, but is that you?

  7. #7
    Member
    Join Date
    Mar 2007
    Posts
    131
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Quote Originally Posted by BlakeWalker84120 View Post
    UFT 11.5 here.

    I took bklabel1's code and put it into a global functions library. Tried two versions, one with just ExecuteTest and one with Execute "ExitTest", neither of them stopped the test. However, without using a function library (just putting those functions directly at the end of the script that calls them), they work just fine.

    So, functions created in the same script where they are called will exit the test, but the same functions in a separate function library will not.
    I'm not sure if you did a typo, but what exactly is the line where you use "ExecuteTest"? I don't think that is a keyword for QTP use.

    I'm not sure what you are trying to say, but your last statement, by itself, is not true.
    "On Error Resume Next" is what causes the script to keep running when Kevin's function is defined inside a function file and the function is called in the main test case file. Remove that and you will see the run will halt.

    And as I mentioned in my original post, the Exit type functions do stop the test when functions are defined in a function file and called within a test script file, but not when they are called within a registered user defined function used as a method.

    Maybe I am not getting what you are trying to write. Please let me know. Thanks.

  8. #8
    SQA Knight bklabel1's Avatar
    Join Date
    Sep 2012
    Location
    Kew Gardens, United States
    Posts
    2,619
    Post Thanks / Like
    Blog Entries
    1
    Mentioned
    2 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    Peter,
    Yes this is the same Kevin. I do remember you from the CPI Class and Bowne. I'm glad to still see you working with Automation.
    My cell is 646 498 3081. Give me a call sometime.
    I ran into Mike Parr about a year ago.
    Thanks,

    Kevin

  9. #9
    Advanced Member
    Join Date
    Mar 2007
    Location
    Salt Lake City, UT, USA
    Posts
    606
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Quote Originally Posted by PeterKlim View Post
    I'm not sure if you did a typo, but what exactly is the line where you use "ExecuteTest"? I don't think that is a keyword for QTP use.

    I'm not sure what you are trying to say, but your last statement, by itself, is not true.
    "On Error Resume Next" is what causes the script to keep running when Kevin's function is defined inside a function file and the function is called in the main test case file. Remove that and you will see the run will halt.

    And as I mentioned in my original post, the Exit type functions do stop the test when functions are defined in a function file and called within a test script file, but not when they are called within a registered user defined function used as a method.

    Maybe I am not getting what you are trying to write. Please let me know. Thanks.
    The Execute statement is in the QTP helpfile.

    Bklabel1's code is just fine. I copied/pasted it directly into my script and it worked perfectly. The On Error Resume Next statement is what causes QTP to NOT CRASH when the following line divides by zero. The line after that divide by zero error is then run (executed) - that is the line that should exit the test. I tried it as Bklabel1 wrote it, with the Execute "ExitTest" statement, and also without the Execute statement (just ExitTest by itself). In both cases, the function worked perfectly and exited the test ONLY when I defined the function in the actual test script. When I defined the function (both versions) in an external function library, they did not exit the test and the msgbox statement was executed instead.

    Side note: I was not trying to solve your dilemma. I understand that you are not going to move your external functions to your test scripts. I was simply confirming that the external functions are still failing to exit the test in UFT version 11.5 (in response to Blklabel1's question above). Hopefully my additional data might help someone (assuming they have only a small number of functions that could be defined locally) or, if nothing else, maybe it would at least shed light on the fact that, for now, this known bug is unresolved even in 11.5.
    "The last 10% of any software project will take 90% of the budgeted time. The first 90% will take the other 90%"

  10. #10
    SQA Knight bklabel1's Avatar
    Join Date
    Sep 2012
    Location
    Kew Gardens, United States
    Posts
    2,619
    Post Thanks / Like
    Blog Entries
    1
    Mentioned
    2 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    Blake,
    I appreciate you clarifying this and trying it in 11.5.
    I have seen a few QTP code shops where they use a variable to keep track of the status of the function. they use a second variable to keep track of the failure or past string. They "bubble" the status back up through the function stack until they get out of the functions and back to the Action. At that place they check for a pass or fail. They report the string to the result logs.

    It is so unfair that the developers have to do this. Rather than HP fixing the issue, we have to write loads of extra code and pass results all over the place.

    Thanks,

    Kevin

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.34%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:18 PM.

Copyright BetaSoft Inc.