Июн
01
Масло масляное
Недавно надо было запустить выполнение автоматических тестов на виртуальной машине. Но она жутко тормозила и ни как не удавалось открыть скрипт в QTP через диалоговое окно Open (так и не разобрался в чем проблема). В конечном итоге пришел к быстрому и «грязному» решению – запустить скрипт через командную строку с помощью VBScript.
Вот скрипт, который я использовал:
Dim qtApp ‘As QuickTest.Application ‘ Declare the Application object variable
Dim qtTest ‘As QuickTest.Test ‘ Declare a Test object variable
Set qtApp = CreateObject("QuickTest.Application") ‘ Create the Application object
qtApp.Launch ‘ Start QuickTest
qtApp.Visible = True ‘ Make the QuickTest application visible
qtApp.Open "C:\Temp\simple_test", True ‘ Open the test in read-only mode
‘ set run settings for the test
Set qtTest = qtApp.Test
qtTest.Run ‘ Run the test
WScript.StdOut.Write "Status is:" & qtTest.LastRunResults.Status ‘Check the results of the test run
qtTest.Close ‘ Close the test
Set qtResultsOpt = Nothing ‘ Release the Run Results Options object
Set qtTest = Nothing ‘ Release the Test object
Set qtApp = Nothing ‘Release the Application object
Dim qtTest ‘As QuickTest.Test ‘ Declare a Test object variable
Set qtApp = CreateObject("QuickTest.Application") ‘ Create the Application object
qtApp.Launch ‘ Start QuickTest
qtApp.Visible = True ‘ Make the QuickTest application visible
qtApp.Open "C:\Temp\simple_test", True ‘ Open the test in read-only mode
‘ set run settings for the test
Set qtTest = qtApp.Test
qtTest.Run ‘ Run the test
WScript.StdOut.Write "Status is:" & qtTest.LastRunResults.Status ‘Check the results of the test run
qtTest.Close ‘ Close the test
Set qtResultsOpt = Nothing ‘ Release the Run Results Options object
Set qtTest = Nothing ‘ Release the Test object
Set qtApp = Nothing ‘Release the Application object
Такое решение можно использовать для запуска тестов по расписанию.