用于在脚本失败时启用图像捕获的QTP AOM代码不起作用
我使用下面的代码来启用QTP屏幕捕获选项,但它没有存储任何屏幕截图:
代码:
Dim App
Dim qtTest
'Create the QTP Application object
Set App = CreateObject("QuickTest.Application")
'If QTP is notopen then open it
If App.launched <> True then
App.Launch
End If
'Make the QuickTest application visible
App.Visible = True
'Set QuickTest run options
'Instruct QuickTest to perform next step when error occurs
App.Options.Run.ImageCaptureForTestResults = "OnError"
App.Options.Run.RunMode = "Fast"
App.Options.Run.ViewResults = True
'Open the test in read-only mode
App.Open "D:\GUITest4", True
'set run settings for the test
Set qtTest = App.Test
'Instruct QuickTest to perform next step when error occurs
qtTest.Settings.Run.OnError = "NextStep"
'Run the test
qtTest.Run
'Check the results of the test run
MsgBox qtTest.LastRunResults.Status
' Close the test
qtTest.Close
'Close QTP
'App.quit
'Release Object
Set qtTest = Nothing
Set App = Nothing有人能帮上忙吗?
发布于 2016-01-25 23:40:20
试着这样截图:
设置obj = Desktop
obj.capturebitmap strFileName和".png“
要将屏幕截图嵌入到结果本身中,请在strFileName参数中将结果路径指定为: strFileName = Environment.Value("ResultDir") & "\“& Mid(Environment.Value("ActionName"),1,15) & filename.png
发布于 2016-04-30 02:03:28
使用QTP AOM,我们可以捕获将存储在结果文件夹中的屏幕截图,可以通过以下代码进行控制。
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Options.Run.ImageCaptureForTestResults = "OnError"
qtApp.Open "C:\Tests\Test1", True
Set qtTest = qtApp.Test
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") 创建运行结果选项对象
qtResultsOpt.ResultsLocation = "C:\Tests\Test1\Res1" 设置结果位置
qtTest.Run qtResultsOpt 运行测试
qtTest.Close希望对你有所帮助,让我知道结果
https://stackoverflow.com/questions/34944296
复制相似问题