首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >有没有办法使用vba/宏将多个配置一次上载到alm中的一个测试用例?

有没有办法使用vba/宏将多个配置一次上载到alm中的一个测试用例?
EN

Stack Overflow用户
提问于 2017-02-20 21:17:39
回答 1查看 506关注 0票数 0

我遇到这样的情况:我需要在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

EN

回答 1

Stack Overflow用户

发布于 2017-02-24 15:25:42

以下是使用TestId上传批量配置的代码

代码语言:javascript
复制
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
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42345602

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档