Thread

Skip Navigation LinksForums > SpiraTeam Forums > SpiraTeam Issues & Questi... > Getting all SpiraTeam pro...

Getting all SpiraTeam project testcases using WebServices RSS Feed

Thursday, June 9, 2011
A.  I am new to webservice development.
B.  Does someone have an example on how I can use Webservices to get all of a projects test cases in the order they are listed in the project and get all the relevant test case/test step data including values from custom text and list boxes?

Thanks.
7 Replies
Adam SAdam S
re: Margaret D Thomas on Thursday, June 9, 2011
Thursday, June 9, 2011

//Now lets test that we can retrieve a generic list of test cases and test runs from the sample project

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

spiraImportExport.Connection_ConnectToProject(1);

List<RemoteFilter> remoteFilters = new List<RemoteFilter>();

RemoteFilter remoteFilter = new RemoteFilter();

remoteFilter.PropertyName = "OwnerId";

remoteFilter.MultiValue = new MultiValueFilter();

remoteFilter.MultiValue.Values = new int[] { 2, 3 };

remoteFilters.Add(remoteFilter);

remoteFilter = new RemoteFilter();

remoteFilter.PropertyName = "ActiveYn";

remoteFilter.StringValue = "Y";

remoteFilters.Add(remoteFilter);

remoteFilter = new RemoteFilter();

remoteFilter.PropertyName = "ExecutionDate";

remoteFilter.DateRangeValue = new DateRange();

remoteFilter.DateRangeValue.StartDate = DateTime.Parse("12/1/2003");

remoteFilter.DateRangeValue.EndDate = DateTime.Parse("12/31/2003");

remoteFilters.Add(remoteFilter);

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

Adam SAdam S
re: Margaret D Thomas on Thursday, June 9, 2011
Thursday, June 9, 2011

//Retrieve the first test case with its steps

RemoteTestCase remoteTestCase = spiraImportExport.TestCase_RetrieveById(testCaseId3);

Assert.AreEqual("Test Case 3", remoteTestCase.Name);

RemoteTestStep[] remoteTestSteps = remoteTestCase.TestSteps;

Assert.AreEqual(2, remoteTestSteps.Length, "Test Step Count 1");

Assert.AreEqual("Test Step 1", remoteTestSteps[0].Description);

Assert.AreEqual(1, remoteTestSteps[0].Position, "Position 1");

Assert.AreEqual("Test Step 2", remoteTestSteps[1].Description);

Assert.AreEqual(2, remoteTestSteps[1].Position, "Position 2");

Margaret D ThomasMargaret D Thomas
re: Adam S on Thursday, June 9, 2011
Friday, June 10, 2011
Thank you!
I am trying it now.  I have now gotten past the "Object reference..." error with the sample code you provided but it is returning 0 test cases.

However, it appears you have wrote the sample code in .Net and I needed to converted to Java 1.6 which I am writing in IntelliJ :).  So I will play with it from here.  I have a suspicion it is the dates that are not correct. 

With this coding method here are some notes to share:

a.  The RemoteFilters array must be defined and initialized as RemoteFilter[] remoteFilter = new RemoteFilter[5] or else testCase_Retrieve will not accet the remoteFilter paramter.

b. With this version, the properties are treated as get and set value methods.

c.  Setting the date range for RemoteFilters uses a calendar type parameter, not date.

Just a note for those who might be doing this in Java.

Thanks.
Margaret D ThomasMargaret D Thomas
re: Margaret D Thomas on Friday, June 10, 2011
Friday, June 10, 2011
Where can one find a list of the property names to use with RemoteFilters?
Margaret D ThomasMargaret D Thomas
re: Margaret D Thomas on Friday, June 10, 2011
Friday, June 10, 2011
I got it!  If there is an interest I can post an example of how to code it using Java  and IntelliJ.

Daisy DaiDaisy Dai
re: Margaret D Thomas on Friday, June 10, 2011
Thursday, July 21, 2011
I go over the https://www.inflectra.com/SpiraTeam/Downloads.aspx, and cannot find the library which can be added in my IDE.
Where can I found it(the jar file)?
Adam SAdam S
re: Daisy Dai on Thursday, July 21, 2011
Tuesday, July 26, 2011
You can download the necessary Java classes from: www.inflectra.com/Files/JavaSoap30Classes.zip
Tagged
Statistics
  • Started: 6/9/2011
  • Last Reply: 7/26/2011
  • Replies: 7
  • Views: 1334
Powered by KronoDesk v1.1.0.15 | © Copyright Inflectra Corporation 2011-2016 | Licensed to Inflectra Corporation.