Apply RemoteFilter to the CustomProperty of a TestCase

Monday, July 18, 2016
Avatar
Hello everyone,
I'm working with SOAP API V4.0 and trying to retrieve some TestCases with the specified CustomProperty (Integer, named "xls_row"). Here is my code (C#):
            RemoteFilter[] filter = { new RemoteFilter() };
            filter[0].PropertyName = "xls_row";
            filter[0].IntValue = 46;
            RemoteTestCase[] casesFound = spiraImportExport.TestCase_Retrieve(filter, 1, 2);

But, surprisingly, the RemoteFilter does not work as expected. Even the function TestCase_Retrive(...) from which I expected the return as an array with the maximal length = 2 does not work as it described in documentation (https://www.inflectra.com/SpiraDemo/Services/v4_0/ImportExport.aspx?operation=TestCase_Retrieve). It returns the array with the length 172 (it is the same in case if the RemoteFilter parameter is null).

Is there any way to retrieve TestCases filtered by the value of some CustomProperty? And why I get 172 rows when it was only 2 required by the parameter?

Thank you in advance.

Maxim.

1 Replies
Monday, July 18, 2016
Avatar
re: barysmax Monday, July 18, 2016
OK, I found some "nasty" workaround to retrieve TestCase with CustomProperty  named 'propertyName' and has the value 'propertyValue':
int rowsCount =  (int) spiraImportExport.TestCase_Count(null);
var casesFound = spiraImportExport.TestCase_Retrieve(null, 1, rowsCount);
var casesExceptFolders = casesFound.Where(
                somecase => !somecase.Folder
            );
            var caseWithRequiredID = casesExceptFolders.Where(
                somecase => somecase.CustomProperties.Any(
                    property =>
                        property.Definition.Name == propertyName &&
                        property.IntegerValue == propertyValue
                )   
            );
But, I'm still wondering if there is some tool in SOAP API for that...

Also, it seems that the TestCase_Retrieve(..) always returns all TestCase folders in the project, am I right?

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885

 

Statistics
  • Started: Monday, July 18, 2016
  • Last Reply: Monday, July 18, 2016
  • Replies: 1
  • Views: 3769