0

Hi am trying to get a list of test configurations using complex filter I got from ALM GUI (its from the button Copy Filter Settings)

[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:
}

}

I only know how to filter easily using

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

I only found this example in OTA API Documentation:

' 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

Is there any way in ALM Customization to achieve it like this?:

   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

2 Answers2

0

As far as I know, there is no way to get TestConfig entities from any other entity using cross filters.

Try this (in 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;
}

Hope this helps.

icalvo
  • 111
  • 1
  • 3
0

Actually you can use the copied filter text directly like below using F# (for C# it is very similar, just set the filter.Text using the copied filter):

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

But if you want to modify the filter text you copied, it will be not very convenient. For example in the code block line 5, in \00000012\BG_DETECTED_IN_REL, \00000012\ in HEX defined the length of it`s rear value "BG_DETECTED_IN_REL" which has 18 characters. So if you modified any value which has prefix like ********\ you should also modify the prefix accordingly.

However, I think using XFilter is more easy and convenient.