运行测试集时出现错误“ ActiveX组件无法创建对象”

奥扎尔·塔什(Awzar Tash)

我正在尝试使用VBScript从ALM运行UFT脚本,但在行上却出现错误:

set objScheduler = objTestSet.StartExecution ("").

错误:ActiveX组件无法创建对象

完整脚本:

' Script : Run the ALM/QC Test Sets

Dim objTDCon, objTreeMgr, objTestSetFolder, objTestSetList
Dim objTestSet, objScheduler, objExecStatus, objTestExecStatus
Dim strTestSetFolderPath, strTestSetName, strReportStatus, intCounter
'Declare the Test Folder, Test and Host you wish to run the test on
'Enter the URL to QC server
strQCURL = "http://126.144.32.655:8080/qcbin/"
'Enter Domain to use on QC server
strQCDomain = "DEFAULT"
'Enter Project Name
strQCProject = "Test"
'Enter the User name to log in and run test
strQCUser = "alm_user"
'Enter user password for the account above.
strQCPassword = "pass"
'Enter the path to the Test set folder
strTestSetFolderPath = "Root\UFT\"
'Enter the test set to be run
strTestSetName = "GUItest1"
'Enter the target machine to run test
strHostName=""
'Connect to Quality Center and login.
Set objTDCon = CreateObject("TDApiOle80.TDConnection")
'Make connection to QC server
objTDCon.InitConnectionEx strQCURL
'Login in to QC server
objTDCon.Login strQCUser, strQCPassword
'select Domain and project
objTDCon.Connect strQCDomain, strQCProject
'Select the test to run
Set objTreeMgr = objTDCon.TestSetTreeManager
Set objTestSetFolder = objTreeMgr.NodeByPath(strTestSetFolderPath)
Set objTestSetList = objTestSetFolder.FindTestSets (strTestSetName)
intCounter = 1
'find test set object
While intCounter <= objTestSetList.Count
  Set objTestSet = objTestSetList.Item( intCounter)
  If objTestSet.Name = strTestSetName Then
    intCounter = objTestSetList.Count + 1
  End If
  intCounter = intCounter + 1
Wend
'Set the Host name to run on and run the test.

' // Getting Error here:"ActiveX component can't create object"
Set objScheduler = objTestSet.StartExecution ("")
' Set this empty to run local for automation run agent
objScheduler.RunAllLocally = True
'msgbox "Hostname passed"
'objScheduler.TdHostName = strHostName
objScheduler.Run
'Wait for the test to run to completion.
Set objExecStatus = objScheduler.ExecutionStatus
While objExecStatus.Finished = False
  objExecStatus.RefreshExecStatusInfo "all", True
  If objExecStatus.Finished = False Then
    WScript.sleep 5
  End If
Wend
'Below is example to determine if execution failed for error reporting.
strReportStatus = "Passed"
For intCounter = 1 To objExecStatus.Count
  Set objTestExecStatus = objExecStatus.Item(intCounter )
  'msgbox intCounter & " " & objTestExecStatus.Status
  If Not ( Instr (1, Ucase( objTestExecStatus.Status ), Ucase ( "Passed" ) ) > 0 ) Then
    strReportStatus = "Failed"
    testsPassed = 0
    Exit For
  Else
    testsPassed = 1
  End If
Next
objTDCon.DisconnectProject
If (Err.Number > 0) Then
  'MsgBox "Run Time Error. Unable to complete the test execution !! " &
  Err.Description
  WScript.Quit 1
ElseIf testsPassed >0 Then
  'Msgbox "Tests Passed !!"
  WScript.Quit 0
Else
  'Msgbox "Tests Failed !!"
  WScript.Quit 1
End If
曼尼什基督徒

这是我前一段时间写的一个小vbscript。它将执行ALM的特定测试。我提出了一些评论,以便于理解。

On Error Resume Next

Dim objExplorer
'' Getting ALM username
strUserName = InputBox("Please enter your ALM login name:", _
    "ALM login name")
'' Getting ALM password 
strPassword = InputBox("Please enter your ALM Password:", _
    "ALM Password")

'' QTP/UFT script path
Dim Test_path
Test_path = "[QualityCenter] Subject\folder1\sub-folder\script(test) name"

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

''Check if the application is not already Launched
If Not qtApp.Launched then
    qtApp.Launch
Else
    Wscript.Echo "UFT is already open." & vbCrLf & "Please close the UFT and run the script again."
    WScript.Quit
End If

qtApp.Visible = False ''Make the QTP/UFT visible

'' Connecting to ALM
If Not qtApp.TDConnection.IsConnected Then
    qtApp.TDConnection.Connect "ALM URL","Domain","Project", strUserName, strPassword,False
End If
If Err.Number <> 0 Then HandleError

'' Set QTP/UFT run options
qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = False
qtApp.Open Test_path, True ''Open the test in read-only mode
If Err.Number <> 0 Then HandleError

'' set run settings for the test
Set qtTest = qtApp.Test
qtTest.Run ''Run the test
qtTest.Close ''Close the test
qtApp.quit  ''Close the QTP/UFT

Wscript.Echo "Test is completed." ''Comment this line if you don't want the messagebox

Set qtTest = Nothing ''Release the Test object
Set qtApp = Nothing ''Release the Application object

'*****************************************************************************************************************
' Error handler
'*****************************************************************************************************************
Sub HandleError()
    If qtApp.Launched then
        qtApp.Quit
    End If

    numerr = Err.number 
    abouterr = Err.description 
    If numerr <> 0 Then 
        Wscript.Echo "An Error has occurred! Error number " & numerr & " of the type '" & abouterr & "'. Please check the error and run the script again."
    End If
    WScript.Quit
End Sub  

您可以使用任务计划程序来计划此脚本。


更新(基于评论)

要使测试集定期运行,您可以将Vbscript与ALM的OTA API结合使用,并使用Windows Scheduler在计划的时间运行。

set tdc = createobject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "http://qcURL/qcbin/"
tdc.login "yourUserName","yourPassword"
tdc.Connect "yourDomain","yourProject"

Set objShell = CreateObject("WScript.Shell")
Set TSetFact = tdc.TestSetFactory
Set tsTreeMgr = tdc.TestSetTreeManager
Set tsFolder = tsTreeMgr.NodeByPath("Root\Formal Tests\YourTestDirectory")
Set tsList = tsFolder.FindTestSets("Your TestSet name. This is case sensitive!")

Set theTestSet = tsList.Item(1)
Set Scheduler = theTestSet.StartExecution("")
Scheduler.RunAllLocally = True
Scheduler.run

Set execStatus = Scheduler.ExecutionStatus

Do While RunFinished = False
    execStatus.RefreshExecStatusInfo "all", True
    RunFinished = execStatus.Finished
    Set EventsList = execStatus.EventsList

    For Each ExecEventInfoObj in EventsList
        strNowEvent = ExecEventInfoObj.EventType
    Next

    For i= 1 to execstatus.count
        Set TestExecStatusobj =execstatus.Item(i)
        intTestid = TestExecStatusobj.TestInstance
    Next
Loop

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

ActiveX组件无法创建对象VBA运行时错误

来自分类Dev

创建 Outlook 对象会生成 - 运行时错误“429”:ActiveX 组件无法创建对象

来自分类Dev

VBA:Acrobat运行时错误429;ActiveX组件无法创建对象

来自分类Dev

将单元格复制到新工作表列时出现错误429“ Activex组件无法创建对象”

来自分类Dev

分发 xlwings 驱动的 Excel 文件。“ActiveX 组件无法创建对象”错误

来自分类Dev

尝试创建ActiveX组件时出现运行时错误429

来自分类Dev

从VB6 IDE调用Comwrapped Net代码失败,在Win7中出现“ ActiveX组件无法创建对象”,但在WinXP中没有

来自分类Dev

从文件夹中的PowerPoint幻灯片中的文本框中删除字符串-错误ActiveX组件无法创建对象

来自分类Dev

ActiveX组件无法创建对象?.NET COM

来自分类Dev

如何修复VBA中的“执行错误429:ActiveX无法创建对象”错误

来自分类常见问题

运行单元测试时出现IntelliJ错误:无法找到或加载主类$ {surefireArgLine}

来自分类Dev

创建vnext测试项目时出现错误

来自分类Dev

无法创建ActiveX对象

来自分类Dev

ActiveX 组件无法创建对象:PCOMM.autECLConnList

来自分类Dev

Access 调用 Outlook 时出现运行时 429 ActiveX 组件错误

来自分类Dev

出现错误后无法在运行项目时创建.apk

来自分类Dev

在RubyMine中运行单元测试时出现错误“无法加载此类文件-2.0 / Console_ext”

来自分类Dev

尝试创建套接字时出现分段错误 - 程序集

来自分类Dev

使用嵌套对象编写测试时出现 Mogoose 验证错误

来自分类Dev

在硒中创建测试脚本时,出现以下错误

来自分类Dev

尝试通过批处理文件启动QTP时,获取Active X组件无法创建对象

来自分类Dev

尝试运行测试时出现“无法附加测试报告程序”

来自分类Dev

使用CreateObject ActiveX组件无法创建带有已注册类库的对象

来自分类Dev

创建Class对象时出现类型错误

来自分类Dev

创建类对象时出现类型错误

来自分类Dev

RemoteTestNG.java:运行 TestNG 测试集时出现 76 错误

来自分类Dev

并行运行测试时出现错误

来自分类Dev

当我在测试文件中导入组件时,出现错误`无法从'makeStyles.js'找到模块'反应'

来自分类Dev

使用VBA访问ActiveX控件时出现运行时错误'438'问题

Related 相关文章

  1. 1

    ActiveX组件无法创建对象VBA运行时错误

  2. 2

    创建 Outlook 对象会生成 - 运行时错误“429”:ActiveX 组件无法创建对象

  3. 3

    VBA:Acrobat运行时错误429;ActiveX组件无法创建对象

  4. 4

    将单元格复制到新工作表列时出现错误429“ Activex组件无法创建对象”

  5. 5

    分发 xlwings 驱动的 Excel 文件。“ActiveX 组件无法创建对象”错误

  6. 6

    尝试创建ActiveX组件时出现运行时错误429

  7. 7

    从VB6 IDE调用Comwrapped Net代码失败,在Win7中出现“ ActiveX组件无法创建对象”,但在WinXP中没有

  8. 8

    从文件夹中的PowerPoint幻灯片中的文本框中删除字符串-错误ActiveX组件无法创建对象

  9. 9

    ActiveX组件无法创建对象?.NET COM

  10. 10

    如何修复VBA中的“执行错误429:ActiveX无法创建对象”错误

  11. 11

    运行单元测试时出现IntelliJ错误:无法找到或加载主类$ {surefireArgLine}

  12. 12

    创建vnext测试项目时出现错误

  13. 13

    无法创建ActiveX对象

  14. 14

    ActiveX 组件无法创建对象:PCOMM.autECLConnList

  15. 15

    Access 调用 Outlook 时出现运行时 429 ActiveX 组件错误

  16. 16

    出现错误后无法在运行项目时创建.apk

  17. 17

    在RubyMine中运行单元测试时出现错误“无法加载此类文件-2.0 / Console_ext”

  18. 18

    尝试创建套接字时出现分段错误 - 程序集

  19. 19

    使用嵌套对象编写测试时出现 Mogoose 验证错误

  20. 20

    在硒中创建测试脚本时,出现以下错误

  21. 21

    尝试通过批处理文件启动QTP时,获取Active X组件无法创建对象

  22. 22

    尝试运行测试时出现“无法附加测试报告程序”

  23. 23

    使用CreateObject ActiveX组件无法创建带有已注册类库的对象

  24. 24

    创建Class对象时出现类型错误

  25. 25

    创建类对象时出现类型错误

  26. 26

    RemoteTestNG.java:运行 TestNG 测试集时出现 76 错误

  27. 27

    并行运行测试时出现错误

  28. 28

    当我在测试文件中导入组件时,出现错误`无法从'makeStyles.js'找到模块'反应'

  29. 29

    使用VBA访问ActiveX控件时出现运行时错误'438'问题

热门标签

归档