我遇到这样的情况:我需要在HP-ALM(应用生命周期管理)中添加多个配置到测试用例中。
手动添加100s的配置是一项平凡的任务。
对于ALM中的测试用例,有没有办法使用宏/vba一次上载多个配置?
例如:我有一个测试步骤,如下所示,其中添加了一个参数' field‘,我想在不同的测试用例中使用不同的字段值来执行此测试用例。如果表中有100个字段需要验证,我将不得不为alm中的单个测试用例手动添加100个配置。不知道是否有任何vba脚本可以导出放在excel列中的配置并将其映射到指定的测试id。
在本例中,我必须为所有字段(EmpID、EmpName、EmpDesignation等)添加配置到我的测试用例中。在待验证的表中:
config1: Verify_EmpID_in_Table-XYZ
config2: Verify_EmpName_in_Table-XYZ
config3: Verify_EmpDesignation_in_Table-XYZ
发布于 2017-02-24 15:25:42
以下是使用TestId上传批量配置的代码
Sub Add_Configurations()
Dim qcURL As String
Dim qcID As String
Dim qcPWD As String
Dim qcDomain As String
Dim qcProject As String
Dim tdConnection As Object
On Error GoTo ErrHandler:
Set cnf = ThisWorkbook.Sheets("config")
qcURL = cnf.Cells(1, 2)
qcID = cnf.Cells(2, 2)
qcPWD = cnf.Cells(3, 2)
qcDomain = cnf.Cells(4, 2)
qcProject = cnf.Cells(5, 2)
Set tdConnection = CreateObject("TDApiOle80.TDConnection")
tdConnection.InitConnectionEx qcURL
tdConnection.Login qcID, qcPWD
tdConnection.Connect qcDomain, qcProject
lastrow = cnf.Cells(Rows.Count, 5).End(xlUp).Row
For i = 2 To lastrow
Test_Id = cnf.Cells(i, 5)
Set myTest = tdConnection.TestFactory.Item(Test_Id)
Set aNewConfig = myTest.TestConfigFactory.AddItem(Null)
aNewConfig.Name = cnf.Cells(i, 6)
aNewConfig.Post
Set aNewConfig = Nothing
Next
MsgBox "Configurations successfully exported to ALM" & Chr(10) & "Please refresh to view the configurations"
Exit Sub
ErrHandler:
MsgBox "!!!!! Error in exporting configurations !!!!!" & Chr(10) & "possible error causes: " & Chr(10) & Chr(10) & "1. Duplicate configuration name" & Chr(10) & "2. Configuration name is blank for a test id"
Exit Sub
End Subhttps://stackoverflow.com/questions/42345602
复制相似问题