I have an issue with AOM script.Please see the below.
I nedd to run some of Actions automatically, I tried different solutions, but nothing works. My script retrieves the data(QTP script name) from Excel and the run it automatically. But for me is more interesting to run for example Action 2 fromTest1 or Action 3 from Test2(doesn't matter)- not all actions in test, only defined actions.
Dim qtApp, qtTest, qtAction, qtResultsOpt, xlApp, xlBook, xlSheet, iRow, row_count, test_name, action
Set qtApp = CreateObject("QuickTest.Application") 'Create the Application object
If Not qtApp.Launched then
qtApp.Visible = True
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("C:\filename.xls")
Set xlSheet = xlBook.Worksheets("Sheet1")
row_count = xlSheet.usedrange.rows.Count
For iRow = 2 to row_count
'Check if the application is not already Launched
test_name = xlSheet.Rows(iRow).Columns(1).Value
action = xlSheet.Rows(iRow).Columns(2).Value
' Open the test in editable mode
qtApp.Open test_name, False
qtApp.Options.Run.ViewResults = True
Set qtTest = qtApp.Test
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
qtResultsOpt.ResultsLocation = "V:\Results" ' Set the results location
Set qtResultsOpt = Nothing
Set qtTest = Nothing
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
Set qtApp = Nothing
Here the peace of code which I found in internet, this code find the name of Action.
For iCounter=1 to oActCount
act_name = qtApp.Test.Actions(iCounter).Name
Please, advise me the solution for this issue.
Thanks in advance.
is it a special requirement to call action 2 of test1 ...i think if u have any conditional check better do that in action1 of test 1 then call actions from other tests or same test based on condition..
Thanks, but it isn't solution.
I need to run different Actions automatically preferable from external script.
Because you can call an Action in other Action, if you are added Call to Existing Action manually,in other case QTP can't find this Action.