51Testing软件测试论坛

标题: 如何通过调用QTP的AOM实现顺序批量运行测试脚本? [打印本页]

作者: huyaowu    时间: 2009-12-28 16:12
标题: 如何通过调用QTP的AOM实现顺序批量运行测试脚本?
如何通过QTP的AOM实现脚本批量顺序运行?类似QC操作。

[ 本帖最后由 huyaowu 于 2009-12-29 10:19 编辑 ]
作者: huyaowu    时间: 2009-12-28 17:01
Up!! 高手不要潜水啦
作者: huyaowu    时间: 2009-12-29 10:18
顶啊
作者: huyaowu    时间: 2009-12-29 13:08

作者: yuandjing    时间: 2009-12-29 13:37
《QTP项目应用与进阶》有比较详细的介绍

我也附一段我的代码,楼主只需要修改代码加一层循环即可:

Set obj = CreateObject("QuickTest.Application") 'Creates an instance of the QTP
obj.Launch
obj.Visible = true
obj.WindowState = "Maximized" 'Maximizes the application window of the QTP
obj.open "c:\framework\frameworkcore\core data\test"
        Set qtLibraries = obj.Test.Settings.Resources.Libraries ' Get the libraries collection object
                If qtLibraries.Find("c:\framework\frameworkcore\"&app&"\core data\main.vbs") = -1 Then
                        qtLibraries.Add "c:\framework\frameworkcore\"&app&"\core data\main.vbs", 1
                End If
'Set qtTestRecovery = obj.Test.Settings.Recovery
'qtTestRecovery.Add "C:\Framework\FrameworkCore\Core Data\Recovery.qrs", "pop-up", 1
'' Enable all scenarios
'For intIndex = 1 To qtTestRecovery.Count ' Iterate the scenarios
'    qtTestRecovery.Item(intIndex).Enabled = True ' Enable each Recovery Scenario (Note: the 'Item' property is default and can be omitted)
'Next
'' Enable the recovery mechanism (with default, on errors, setting)
'qtTestRecovery.Enabled = True
''Ensure that the recovery mechanism is set to be activated only after errors
'qtTestRecovery.SetActivationMode "OnError"
''OnError is the default, the other option is "OnEveryStep".
WScript.Echo "Running Qtp in Silent Mode..."
obj.Test.Run 'Runs the script
wscript.sleep(7000)
WScript.Echo "QTP script execution completed..."
obj.Test.Close ' Close the test
WScript.Echo "Closing Qtp...."
obj.quit 'Close QTP
作者: huyaowu    时间: 2009-12-29 15:26
Thanks!!!




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2