Вопрос:
Возможно ли, используя параметры коммандной строки, заставиь Quick Test открыть при запуске скрипт и сразу запустить его?
Ответ:
Используйте QTP CommandLine Utility из QTP Plus (должен быть на одном компакте с дистрибутивом QTP) ...
... А ещё лучше - вместа запуска из коммандной строки, использовать QTP Automation (см. Help). Вот пример из Help:
****************************************************************************
********************************************
' Для запуска - сохраните этот скрипт как vbs и запустите из Windows (не из QTP)
'Description:
'
'This example opens a test, configures run options and settings,
'runs the test, and then checks the results of the test run.
'
'Assumptions:
'There is no unsaved test currently open in QuickTest.
'For more information, see the example for the Test.SaveAs method.
'When QuickTest opens, it loads the add-ins required for the test.
'For more information, see the example for the Test.GetAssociatedAddins method.
& #39;****************************************************************************
********************************************
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.CaptureForTestResults = "OnError"
qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = False
qtApp.Open "C:\Tests\Test1", 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 = 2
qtTest.Settings.Run.EndIteration = 4
qtTest.Settings.Run.OnError = "NextStep" ' Instruct QuickTest to perform next step when error occurs
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
qtResultsOpt.ResultsLocation = "C:\Tests\Test1\Res1" ' Set the results location
qtTest.Run qtResultsOpt ' Run the test
MsgBox 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
QTP: Запуск из коммандной строки
Автор Mike, 27 июн 2005 12:20
В теме одно сообщение
#1
Отправлено 27 июня 2005 - 12:20
Best regards,
Майк.
Майк.
#2
Отправлено 18 ноября 2007 - 15:19
Вопрос:
Возможно ли, используя параметры коммандной строки, заставиь Quick Test открыть при запуске скрипт и сразу запустить его?
Ответ:
Используйте QTP CommandLine Utility из QTP Plus (должен быть на одном компакте с дистрибутивом QTP) ...
А ещё лучше - вместа запуска из коммандной строки, использовать QTP Automation (см. Help). Вот пример из Help:
...skipped...
А теперь усложним задачу - как с коммандной строки запустить QTP тесты на *нескольких удаленных* машинах?
Ответ прост - это можно сделать с использованием WMI. Преимущества:
- Код весьма прост и понятен
- Не требуется инсталяция дополнительных библиотек, т.к. используются native средства ОС Windows
How to execute program on remote computer?
Количество пользователей, читающих эту тему: 0
0 пользователей, 0 гостей, 0 анонимных