2017-02-20 34 views
0

我有情况需要在HP-ALM(应用程序生命周期管理)中将多个配置添加到测试用例中。有没有办法一次上传多个配置到一个使用vba /宏的测试用例?

手动添加100个配置是普通的任务。

有没有办法一次上传多个配置使用宏/ vba在ALM中的测试用例?

例如:我有一个测试步骤,下面添加了一个参数'field',我想在不同的测试用例中使用不同的字段值来执行这个测试用例。如果一个表中有100个字段需要验证,那么我必须在alm中为一个测试用例手动添加100个配置。想知道是否有任何vba脚本可以导出放置在excel列中的配置并将其映射到指定的测试ID。

在这种情况下我不得不CONFIGS添加到我的测试案例表中的所有领域(的EmpID,EmpName,EmpDesignation等)进行验证:

CONFIG1:Verify_EmpID_in_Table-XYZ
CONFIG2:Verify_EmpName_in_Table- XYZ
CONFIG3:Verify_EmpDesignation_in_Table-XYZ

+0

是上传批量配置的代码,它是可能使用OTA。你可以在你的问题中添加一个示例配置? – Barney

+0

我已经为示例测试用例添加了一个示例配置。让我知道是否有更多的信息被添加。 –

回答

0

下面是一个使用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 Sub 
相关问题