Created By  inflectra.adam Monday, November 26, 2012
This article describes the process for calling SpiraTest / SpiraTeam using its SOAP web service API to query the system to retrieve a list of test cases that match a specific name so that you can obtain its test case id.

You need to do the following:

1) Authenticate with SpiraTeam and connect to the project

   spiraImportExport.Connection_Authenticate("fredbloggs", "fredbloggs");
   spiraImportExport.Connection_ConnectToProject(1);

2) Create the filter to retrieve test cases that match the name 'Test Case 1'

   List<RemoteFilter> remoteFilters = new List<RemoteFilter>();
   RemoteFilter remoteFilter = new RemoteFilter();
   remoteFilter.PropertyName = "Name";
   remoteFilter.StringValue = "Test Case 1";
   remoteFilters.Add(remoteFilter);

3) Now retrieve the results

RemoteTestCase[] remoteTestCases = spiraImportExport.TestCase_Retrieve(remoteFilters.ToArray(), 1, 999999);

4) Finally get the test case id from the results

RemoteTestCase matchingTestCase = remoteTestCases[0];
int testCaseId = matchingTestCase.TestCaseId.Value;

 

Article Info
  • Last Updated: 11/26/2012
  • Article ID: KB29
  • Views: 2474