【问题标题】:How to filter/get Test Lab instances/configurations using cross filter in ALM using OTA API?如何使用 OTA API 在 ALM 中使用交叉过滤器过滤/获取测试实验室实例/配置?
【发布时间】:2016-01-19 18:45:26
【问题描述】:

您好,我正在尝试使用从 ALM GUI 获得的复杂过滤器获取测试配置列表(它来自按钮复制过滤器设置)

[Filter]{
TableName:CYCLE,
ColumnName:CY_CYCLE_ID,
LogicalFilter:409,
VisualFilter:409,
NO_CASE:
}
{
TableName:CYCLE,
ColumnName:CY_FOLDER_ID,
LogicalFilter:\0000001a\^Root\Test sety 01\Podzim^,
VisualFilter:\0000001a\^Root\Test sety 01\Podzim^,
NO_CASE:
}
{
FLT:[X],
TYPE:TESTSET-TSTEST,
EXISTS_IN_IDS:Y,
IN_IDS:\0000007a\[Filter]{
TableName:TESTCYCL,
ColumnName:TC_TESTER_NAME,
LogicalFilter:username,
VisualFilter:username,
NO_CASE:
}

}

我只知道如何轻松使用过滤

TestConfigFactory.Filter.SetXFilter ("Value from database") = "Value"

我只在 OTA API 文档中找到了这个示例:

' Get the Test filter object. This filter is unconditional.
' We want all the tests from the test set.
'
    Dim testF As TestFactory, testFilter As TDFilter
    Set testF = tdc.TestFactory
    Set testFilter = testF.Filter

' Set the cross filter: All tests associated with the
' test sets that meet the criteria - in this case, the
' one test set whose name was passed to this routine.
    testFilter.SetXFilter "TEST-TESTSET", True, tsFilter.Text

在 ALM 自定义中有什么方法可以实现这样的吗?:

   set testConfigFact = TDConnection.TestConfigFactory
   set testConfigFilter = testConfigFact.Filter
   testConfigFilter.SetXFilter ("SOMETHING") = [Filter]{
                TableName:CYCLE,
                ColumnName:CY_CYCLE,
                LogicalFilter:igor,
                VisualFilter:igor,
                NO_CASE:
                }
   set testConfigList = testConfigFilter.NewList()
   set testCfg = testConfigList.Item(1)
   msgbox "test config: " & testCfg.ID

【问题讨论】:

    标签: api customization alm ota hp-quality-center


    【解决方案1】:

    据我所知,无法使用交叉过滤器从任何其他实体获取 TestConfig 实体。

    试试这个(在 C# 中):

    TSTestFactory tsTestFact = entTestSet.TSTestFactory;
    
    // tdFilter is the TDFilter you want to apply to __TestInstances__
    List tsTestList = tdFilter == null ?  
        tsTestFact.NewList(String.Empty) :
        tsTestFact.NewList(tdFilter.Text);
    
    foreach (TSTest testInstance in tsTestList)
    {
        TestConfig testConfig = testInstance.TestConfiguration;
    }
    

    希望这会有所帮助。

    【讨论】:

      【解决方案2】:

      其实你可以直接使用复制的过滤器文本,如下面使用 F# (对于 C# 非常相似,只需使用复制的过滤器设置 filter.Text):

      let bf = connection.BugFactory :?> BugFactory
      let filter = bf.Filter :?> TDFilter
      filter.Text <- @"[Filter]{
      TableName:BUG,
      ColumnName:\00000012\BG_DETECTED_IN_REL,
      SortOrder:2,
      SortDirection:0,
      NO_CASE:
      }
      {
      TableName:BUG,
      ColumnName:BG_RESPONSIBLE,
      LogicalFilter:[CurrentUser],
      VisualFilter:[CurrentUser],
      NO_CASE:
      }
      {
      TableName:BUG,
      ColumnName:BG_SUMMARY,
      SortOrder:1,
      SortDirection:0,
      NO_CASE:
      }
      [Grouping]{
      ColumnName:BG_STATUS,
      GroupOrder:1
      }"
      let result = bf.NewList(filter.Text)
      printfn "%d" result.Count
      

      但是如果你想修改你复制的过滤文本,那就不太方便了。例如在代码块第 5 行中,在 \00000012\BG_DETECTED_IN_REL 中,\00000012\ in HEX 定义了它的后值“BG_DETECTED_IN_REL”的长度,它有 18 个字符。因此,如果您修改了任何前缀为 ********\ 的值,您也应该相应地修改前缀。

      不过,我认为使用 XFilter 更简单方便。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多