Running QTP Script through vbs file

Public Sub ExecuteTest(TestPath)

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Dim qtResultsOpt 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible

' Set QuickTest run options
qtApp.Options.Run.ImageCaptureForTestResults = "OnError"
qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = True

'This will Open a script
qtApp.Open TestPath , True ' Open the test in read-only mode


' set run settings for the test
Set qtTest = qtApp.Test
qtTest.Settings.Run.IterationMode = "rngIterations" ' Run only iterations 2 to 4
qtTest.Settings.Run.StartIteration = 1
qtTest.Settings.Run.EndIteration = 1
qtTest.Settings.Run.OnError = "NextStep" ' Instruct QuickTest to perform next step when error occurs

'For Viewing Results
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
qtResultsOpt.ResultsLocation = "C:\Telecom Automation Scripts\Res1" ' Set the results location
qtTest.Run qtResultsOpt ' Run the test
qtApp.Options.Run.ViewResults = True

'Close QTP
'qtTest.Close ' Close the test

'Set the options to nothing
Set qtResultsOpt = Nothing ' Release the Run Results Options object
Set qtTest = Nothing ' Release the Test object
Set qtApp = Nothing ' Release the Application object

End Sub

comment 4 comments:

Mounika on January 5, 2019 at 2:32 AM said...

This is a terrific article, and that I would really like additional info if you have got any. I’m fascinated with this subject and your post has been one among the simplest I actually have read.
python Training institute in Pune
python Training institute in Chennai
python Training institute in Bangalore

priya on February 4, 2019 at 3:30 AM said...

It is better to engaged ourselves in activities we like. I liked the post. Thanks for sharing.
Data Science Training in Chennai
Data Science course in anna nagar
Data Science course in chennai
Data science course in Bangalore
Data Science course in marathahalli
Data science course in bangalore

Anu on May 24, 2020 at 9:32 AM said...



Thanks For Sharing The information The Information Shared Is Very Valuable Please Keep Updating us The Information shared Is Very Valuable devops training in chennai | devops training in anna nagar | devops training in omr | devops training in porur | devops training in tambaram | devops training in velachery

David Fincher on January 23, 2022 at 9:08 PM said...

This post is so interactive and informative.keep update more information...
SEO Training in Tambaram
SEO Training in ChennaiS

  • Recent Posts

     
    © QTPCode | Design by Blog template in collaboration with Concert Tickets, and Menopause symptoms
    Powered by Blogger