Thread

Skip Navigation LinksForums > SpiraTest Forums > SpiraTest Issues & Questi... > Apply RemoteFilter to the...

Apply RemoteFilter to the CustomProperty of a TestCase RSS Feed

Monday, July 18, 2016
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 (http://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
Maxim BaryshnikovMaxim Baryshnikov
re: Maxim Baryshnikov on Monday, July 18, 2016
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?
Tagged
Statistics
  • Started: 7/18/2016
  • Last Reply: 7/18/2016
  • Replies: 1
  • Views: 2165
Powered by KronoDesk v1.1.0.15 | © Copyright Inflectra Corporation 2011-2016 | Licensed to Inflectra Corporation.