SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 8 of 8
  1. #1
    Member
    Join Date
    Nov 2011
    Posts
    66
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Clarification needed on Post Recovery Step

    Hello Everyone ,

    Currently , i am facing a weird behaviour while implementing "object not found" Recovery scenario . My qtp scrip is as follows
    <font class="small">Code:</font><hr /><pre>
    --some code---
    Step 1 ( this is where a object not found error occurs and Recovery scenario gets activated properly)

    Step 2
    ---some code ---
    </pre><hr />

    Now , Recovery scenario triggers properly at step 1 therefore it closes the application and restarts the application again (working perfectly fine according to defined behaviour). As part of post recovery , i have defined "stop the test run" --&gt; this is where is the problem .

    Ideally , recovery scenario must stop the test run after post recovery but unfortunately , qtp excutes next statment step 2 rather stopping the test run .

    Am i missing any thing here ? please help ?

    Regards
    Shobit

  2. #2
    Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    359
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clarification needed on Post Recovery Step

    you can add another post recovery as Function Call.. and in function, write Exit Test.

  3. #3
    Member
    Join Date
    Nov 2011
    Posts
    66
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clarification needed on Post Recovery Step

    Hello John , tried "Exit test" as part of recovery but no luck .

    Let me add some more information about the scenario that i am referring here .

    Error occurs at step 1 because object can not be found (let us say that it is a wrong page itself) .QTP triggers recovery properly - closes/open the application (as part of recovery function calls where i also included last operation as "ExitTest" )but then QTP executes step 2 (this must not happen since we are halting test run using post recovery step .Also , i explicitly used "ExitTest" as part of recovery in function call) that again fails due to wrong page and inturn one more time recovery is triggered .It again close/open the application as part of recovery process and then terminates the test .

    I am expecting recovery scenario to be triggered only once and i assume that post recovery step "stop the test run" must halt the test run during first trigger itself but this is not happening .

    Experts please throw few pointers where i am missing/messing things .

    Shobit

  4. #4
    Member
    Join Date
    Nov 2011
    Posts
    66
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clarification needed on Post Recovery Step

    Can any body throw few pointers for above scenario . i am completely blacked out and do not have further thoughts - how i can proceed . please help

    Shobit

  5. #5
    Member
    Join Date
    Jan 2009
    Location
    Canberra
    Posts
    273
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clarification needed on Post Recovery Step

    [ QUOTE ]
    Hello Everyone ,

    Currently , i am facing a weird behaviour while implementing "object not found" Recovery scenario . My qtp scrip is as follows
    <font class="small">Code:</font><hr /><pre>
    --some code---
    Step 1 ( this is where a object not found error occurs and Recovery scenario gets activated properly)

    Step 2
    ---some code ---
    </pre><hr />

    Now , Recovery scenario triggers properly at step 1 therefore it closes the application and restarts the application again (working perfectly fine according to defined behaviour). As part of post recovery , i have defined "stop the test run" --&gt; this is where is the problem .

    Ideally , recovery scenario must stop the test run after post recovery but unfortunately , qtp excutes next statment step 2 rather stopping the test run .

    Am i missing any thing here ? please help ?

    Regards
    Shobit

    [/ QUOTE ]


    I tried to reproduce your issue and could not.
    I have a script that works on Windows Notepad and I deliberately generate a "Object is disabled" error which gets caught by a recovery scenario. See code below


    <font class="small">Code:</font><hr /><pre>
    SystemUtil.Run "C:\WINDOWS\system32\notepad.exe","","%HOMEDRIVE%% HOMEPATH%",""
    Window("Notepad").Activate
    Window("Notepad").WinEditor("Edit").Type "test line 1"
    <font color="green"> ' exit note pad - will cause the "Do you want to save changes dialog to pop up"
    </font>

    Window("Notepad").WinMenu("Menu").Select "File;Exit"
    <font color="green"> ' Try to type in notepad while the dialog is up. Should cause an "object is disabled error" and the recovery scenario to kick in.

    </font>

    Window("Notepad").WinEditor("Edit").Type "test line 2"

    print "we are after the Window(""Notepad"").WinEditor(""Edit"").Type test line 2 step "
    reporter.ReportEvent micDone ,"stop demo", "we are after the Window(""Notepad"").WinEditor(""Edit"").Type test line 2 step "


    </pre><hr />

    The recovery scenario has these properties

    <font class="small">Code:</font><hr /><pre>
    Scenario: Demo_rec_scenario_stop
    Defined in: X:\QTP\Common\Demo_rec_scenario_stop.qrs
    recovery operation: close process notpade.exe
    Post-recovery operation: Stop the test run.

    Activated by trigger:
    Type: Test run error
    The error string: Any error


    </pre><hr />

    If we run this then the test does a
    <font class="small">Code:</font><hr /><pre>

    Object is disabled


    Scenario: Demo_rec_scenario_stop
    Defined in: X:\QTP\Common\Demo_rec_scenario_stop.qrs
    Description:
    Post-recovery operation: Stop the test run.

    Activated by trigger:
    Type: Test run error
    The error string: Any error

    The current test step details:
    Object: WinEditor("Edit")
    Method: Type
    Arguments: 111
    Result: Object is disabled


    Close the following processes: notepad.exe
    notepad.exe (PID: 536) Closed


    Stop the test run


    Run stopped by user.

    </pre><hr />

    And the steps

    print "we are after the Window(""Notepad"").WinEditor(""Edit"").Type test line 2 step "

    and

    reporter.ReportEvent micDone ,"stop demo", "we are after the Window(""Notepad"").WinEditor(""Edit"").Type test line 2 step "

    Never run.

    I am running QTP10

    With these patches

    QTP_00598 for HP QuickTest Professional 10.00 QFE
    QTP_00626 for HP QuickTest Professional 10.00 QFE
    QTP_00644 for HP QuickTest Professional 10.00 QFE
    QTP_00684 for HP QuickTest Professional 10.00 QFE

    So you might have a bug. But you could try to run my demo script (see attatched .zip - if the attatchment process works)
    Attached Files Attached Files

  6. #6
    Member
    Join Date
    Jul 2009
    Location
    Hyderabad, India
    Posts
    34
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clarification needed on Post Recovery Step

    Your requirement is to exit the test when you get an error.
    In that case why do you want to go for recovery scenario. Just go to File-&gt;Settings-&gt;Run-&gt;Select "Stop Run" value in the list box for the option "When Error Occurs".

    You can go to recovery scenario when you want to do some operation on the object or application.

    For example for the error "object not found" you might need to send the details of the object to result. In such cases use the below function and in post recovery operation select "Stop the Test Run" option. But if you directly want to stop the test run on error don't go to recovery operation.

    Function TestRun(Object, Method, Arguments, retVal)

    Set Props = object.GetTOProperties
    PropsCount = Props.Count
    For i = 0 To PropsCount - 1
    PropName = Props(i).Name
    PropValue = Props(i).Value
    PropCol= PropName &amp; " = " &amp; PropValue&amp;vbnewline
    Next
    Reporter.reportEvent micFail,DescribeResult(retVal),PropCol
    End Function
    Sudhakar Kakunuri
    QtpSudhakar.Com

  7. #7
    Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    359
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clarification needed on Post Recovery Step

    once you define a function call in RS wizard, it adds a function in you library- for example

    Function Recovery1(Object)
    End Function

    go to that function in the lib and add Exit Test or Exit Action, and it shud work. try it...

    Function Recovery1(Object)
    ExitAction
    msgbos "now terminating"
    End Function

  8. #8
    Member
    Join Date
    Nov 2011
    Posts
    66
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Clarification needed on Post Recovery Step

    Thanks All , especially to ttguy

    I ran my testcase again after fixing my Sync related issue. Now , Recovery seems to be working fine . I am still wondering what was wrong earlier . Thanks every one for support !

    Shobit

 

 

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 © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 9.68%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 01:43 AM.

Copyright BetaSoft Inc.