51Testing软件测试论坛

标题: 紧急求助~!关于QuickTest Automation 的问题。。 [打印本页]

作者: wugecat    时间: 2010-10-19 14:51
标题: 紧急求助~!关于QuickTest Automation 的问题。。
我想通过vbs调用QTP并且实现保存执行的录像。。在帮助中查到object.MovieCaptureForTestResults。。可是为什么我吧他的例子直接拷贝过来,执行时在qtApp.Options.Run.MovieCaptureForTestResults = "OnWarning"一行会报“对象不支持此属性和方法”的??

  1. Dim qtApp 'As QuickTest.Application ' Declare the Application object variable

  2. Dim qtTest 'As QuickTest.Test ' Declare a Test object variable

  3. Dim qtMovieOpts 'As QuickTest.ScreenRecorderOptions ' Declare a Run Results Options object variable

  4. Dim qtResultsOpt 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable



  5. Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object

  6. qtApp.Launch ' Start QuickTest

  7. qtApp.Visible = True ' Make the QuickTest application visible



  8. ' Set QuickTest movie options

  9. qtApp.Options.Run.MovieCaptureForTestResults = "OnWarning" 'Set QuickTest to capture movie segments of each error and warning

  10. qtApp.Options.Run.SaveMovieOfEntireRun = "FALSE" 'Save only the movie segements that lead up to an error or warning

  11. qtApp.Options.Run.MovieSegmentSize = "4000" 'Set each movie segment to be a maximum of 4MB.





  12. Set qtMovieOpts = qtApp.Options.Run.ScreenRecorder ' Create a Screen Recorder Options object



  13. 'Set movie recording preferences to minimize the movie file size

  14. qtMovieOpts.DeactivateShowWindowContents = True

  15. qtMovieOpts.RecordSound = False

  16. qtMovieOpts.SetPlainWallpaper = True





  17. qtApp.Open "C:\Tests\Test1", True ' Open a test in read-only mode



  18. ' set run settings for the test

  19. Set qtTest = qtApp.Test

  20. qtTest.Settings.Run.IterationMode = "oneIteration" ' Run one iteration of the test

  21. qtTest.Settings.Run.OnError = "NextStep" ' Instruct QuickTest to perform next step when an error occurs



  22. Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object

  23. qtResultsOpt.ResultsLocation = "C:\Tests\Test1\Res1" ' Set the results location



  24. qtTest.Run qtResultsOpt ' Run the test and record a movie of the run.



  25. qtTest.Close ' Close the test



  26. Set qtResultsOpt = Nothing ' Release the Run Results Options object

  27. Set qtTest = Nothing ' Release the Test object

  28. Set qtApp = Nothing ' Release the Application object
复制代码

作者: wugecat    时间: 2010-10-19 15:03
up
作者: wugecat    时间: 2010-10-19 17:26
up
作者: medoraemon    时间: 2010-10-19 17:28
静待佳音




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