Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Run QTP Test using VBscript
#1
Solved: 11 Years, 4 Months, 1 Week ago
Hi I am using QTP to test windows application.
I have created test1 with 10 action action1 , action2 .. action 10

Now I am running test using VB script.
By default its start with Action1.

however I want to run action order specify by me on the fly using vbscript.

Some times I want to run Action 2 and Action 10 and some time Action 1 and Action 10 like that its depend of condition.

here is my vbscript

Code:
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtOptions 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable
Set qtApp = CreateObject("QuickTest.Application") ' Create a 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




' Open the test
qtApp.Open "C:\Tests\Test1\Test1", False ' Open a test named "Test1"

Set qtOptions = CreateObject("QuickTest.RunResultsOptions") ' Create a Results Option object
qtOptions.ResultsLocation = "C:\Tests\Results\" ' Set the Results location to temporary location

' 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

[i]'  [u]qtTest.RunAction "Action1",oneIteration[/u] I need some thing like this. but dont know how to use.[/i]

qtApp.Test.Run qtOptions, True ' Run the test and wait for it to finish before continuing the automation script


qtApp.Test.Save ' Save the test

qtApp.Quit ' Exit QuickTest
Set qtOptions = Nothing ' Release the Run Results Options object
Set qtApp = Nothing ' Release the Application object
Reply
#2
Solved: 11 Years, 4 Months, 1 Week ago
You cant do the way you mentioned in your vbs. the vbs will help you open the test not the action which are associated with your test.
one of the way could be write some more code in your test to run an action based on certain condition on input to the test.
you can pass the input parameter to the test from vbs and then in your test you can decide which action to run.

Reply
#3
Solved: 11 Years, 4 Months, 1 Week ago
Hi Saket thanks for response.
can you please provide some sample for same, if it is possible.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Send automatic email notification when test run started helmzshelmz 0 1,083 04-03-2020, 07:54 AM
Last Post: helmzshelmz
  How to find and change text in PDF document using QTP UFT automation VBscript alexwhite 0 12,061 02-18-2017, 04:20 AM
Last Post: alexwhite
  Error while opening test run results vkalyankar 3 4,320 11-12-2014, 09:49 AM
Last Post: vinod123
  Hyperlink click is not automated in UFT 11.5 test run prinju 1 2,805 11-03-2014, 12:04 PM
Last Post: vinod123
  Test run cannot continue oak 1 4,860 11-03-2014, 10:54 AM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)