SPONSORS:






User Tag List

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

    Load recovery scenario from PERL

    Is there a way to load a recovery scenario from perl? I am using Win32::OLE to run the tests. Here is what I have so far:

    eval
    {
    $qtpApp = Win32::OLE->new( 'Quicktest.Application', 'Quit' ) or die print "ERROR - Unable to create the QTP Object";
    };
    die $@ if ($@);
    $qtpApp->Open($testPath,1,0);
    $qtpApp->Launch;
    $qtpApp->{Visible} = 0;
    $qtResultsOpt = Win32::OLE->new( 'QuickTest.RunResultsOptions', 'Quit' );
    $qtResultsOpt->{ResultsLocation} = $resultPath;
    $qtpApp->Test->Run($qtResultsOpt);

  2. #2
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: Load recovery scenario from PERL

    Well i don't know PERL, but you can look in QTP help file for code to add a recovery scenario and then convert to PERL OLE. Here is the code for your reference

    From QTP help file
    <font class="small">Code:</font><hr /><pre>
    '************************************************* ************************************************** *********************
    'Description:
    '
    'This example uses the Recovery collection to specify a set of
    'recovery scenarios to associate with a new test.
    '
    'Assumptions:
    'There is no unsaved test currently open in QuickTest.
    'For more information, see the example for the Test.SaveAs method.
    '************************************************* ************************************************** *********************

    Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
    Dim qtTestRecovery 'As QuickTest.Recovery ' Declare a Recovery object variable
    Dim intIndex ' Declare an index variable

    ' Open QuickTest and prepare objects variables
    Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
    qtApp.Launch ' Start QuickTest
    qtApp.New ' Open a new test
    qtApp.Visible = True ' Make the QuickTest application visible
    Set qtTestRecovery = qtApp.Test.Settings.Recovery ' Return the Recovery object for the current test

    If qtTestRecovery.Count &gt; 0 Then ' If there are any default scenarios specified for the test
    qtTestRecovery.RemoveAll ' Remove them
    End If

    ' Add recovery scenarios
    qtTestRecovery.Add "C:\Recovery.qrs", "ErrMessage", 1 ' Add the "ErrMessage" scenario as the first scenario
    qtTestRecovery.Add "C:\Recovery.qrs", "AppCrash", 2 ' Add the "AppCrash" scenario as the second scenario
    qtTestRecovery.Add "C:\Recovery.qrs", "ObjDisabled", 3 ' Add the "ObjDisabled" scenario as the third scenario

    ' Enable all scenarios
    For intIndex = 1 To qtTestRecovery.Count ' Iterate the scenarios
    qtTestRecovery.Item(intIndex).Enabled = True ' Enable each Recovery Scenario (Note: the 'Item' property is default and can be omitted)
    Next

    ' Enable the recovery mechanism (with default, on errors, setting)
    qtTestRecovery.Enabled = True

    'Ensure that the recovery mechanism is set to be activated only after errors
    qtTestRecovery.SetActivationMode "OnError"
    'OnError is the default, the other option is "OnEveryStep".

    Set qtApp = Nothing ' Release the Application object
    Set qtTestRecovery = Nothing ' Release the Recovery object
    </pre><hr />

 

 

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 12.50%
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 10:40 AM.

Copyright BetaSoft Inc.