2017-02-20 35 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 
相關問題