04-08-2010, 09:55 PM
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
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