This topic relates to the legacy Test Cases screen that provided basic test management functionality and was replaced with Test Management. Starting from release 9.7.0, this functionality is obsolete and is supported only for backward compatibility. |
Use the TestCases_LoadByCriteria
operation to:
-
Get test cases that match a specific condition. For example, created by a specific user or on a specific day.
-
Get all test cases in QAComplete projects (if no condition is specified).
The operation can get test cases from one or several projects. To specify a project to get test cases from, use the ProjId
value in the AuthenticationData
object in the request body. To get test cases from several projects, use the ProjIds
value in the AuthenticationData
object to specify the list of project IDs.
LoadByCriteria
returns results in pages (subsets of data) rather than all at once. Pagination is controlled by the PageSize
and PageNumber
parameters. For information about working with paginated results, see LoadByCriteria Operations.
You can use the Sorting
parameter to sort the test cases before returning them from QAComplete.
To get just one test case, use TestCases_Load
. Also, you can get all test cases that use the specified automation script using TestCases_LoadByUNC
Requirements
The authenticating user must belong to a user group that has the Read privilege for Test Cases.
Parameters
The operation uses the following parameters:
AuthenticationData : AuthenticationData, required
An AuthenticationData
object with the login information and the ID of the project (or the list of project IDs) that contains the test cases.
Condition : string (max 65536 chars)
An XML-formatted string that describes the test cases you want to get. For the syntax and examples, see Condition Syntax.
If you create SOAP requests manually, place the condition string inside CDATA.
To get all releases, use an empty string or a null value.
Sorting : string (max 512 chars)
The order to sort the results before returning them from the web service. For example, by test case ID or last updated date. The format is:
Property1 [ASC | DESC ][, Property2 [ASC | DESC ]] [, ...]]]
where property names are those of the TestCase
object. If you omit ASC or DESC after a property name, test cases are sorted in ascending order.
Example values:
To keep the default sort order, use an empty string or a null value.
PageSize : integer, required
Limits the number of test cases to return in one page. Possible values: 1..200.
The last page may have less items than PageSize
. This means the end of the result set.
PageNumber : integer, required
A number starting from 1 that specifies the data page to return in the response. To get all pages, send several requests with increasing PageNumber
values. For example, if PageSize
is 100, PageNumber
of 1 will return test cases 1..100, PageNumber
of 2 – test cases 101..200 and so on.
If PageNumber
exceeds the range, an empty array is returned. If PageNumber
is the last page, this page may have less items than PageSize
.
Result
An array of TestCase
objects that represents the test cases.
Example
Sample Code
This example loads all Failed test cases sorted by priority.
C#
string login = "[email protected]";
string password = "p@ssword";
int projID = 10372;
// Specifying the condition
string condition =
@"<Conditions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
Operation='opEQU'>
<Items Type='tField'>
<Value xsi:type='xsd:string'>StatusCode</Value>
</Items>
<Items Type='tString'>
<Value xsi:type='xsd:string'>Failed</Value>
</Items>
</Conditions>";
string Sorting = "";
int pageSize = 200;
ServiceSoapClient service = new ServiceSoapClient();
// Preparing AuthenticationData
LoginInfo loginInfo = service.GetLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.AppCode = loginInfo.AppCode;
authData.UserId = loginInfo.UserId;
authData.PassCode = password;
authData.DeptId = loginInfo.DeptId;
authData.ProjId = projID;
// Preparing an array of TestCase objects
TestCase[] testCases = new TestCase[0];
int pageNumber = 1;
do
{
testCases = service.TestCases_LoadByCriteria(authData, condition, Sorting, pageSize, pageNumber);
foreach (TestCase testCase in testCases)
{
Console.WriteLine("{0}: {1}", testCase.Title, testCase.StatusCode);
}
pageNumber++;
} while(testCases.Length == pageSize);
Java
String login = "[email protected]";
String password = "p@ssword";
int projID = 10372;
// Specifying the desired condition
String condition =
"<Conditions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' \n" +
" xmlns:xsd='http://www.w3.org/2001/XMLSchema'\n" +
" Operation='opEQU'>\n" +
" <Items Type='tField'>\n" +
" <Value xsi:type='xsd:string'>StatusCode</Value>\n" +
" </Items>\n" +
" <Items Type='tString'>\n" +
" <Value xsi:type='xsd:string'>Failed</Value>\n" +
" </Items>\n" +
"</Conditions>\n";
int pageSize = 200;
String Sorting = "";
ServiceSoap service = new Service().getServiceSoap12();
// Preparing AuthenticationData
LoginInfo loginInfo = service.getLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.setAppCode(loginInfo.getAppCode());
authData.setUserId(loginInfo.getUserId());
authData.setPassCode(password);
authData.setDeptId(loginInfo.getDeptId());
authData.setProjId(projID);
// Preparing an array of TestCase objects
List<TestCase> testCases;
int pageNumber = 1;
do {
testCases = service.testCasesLoadByCriteria(authData, condition, Sorting, pageSize, pageNumber).getTestCase();
for (TestCase testCase : testCases)
{
System.out.format("%s: %s%n", testCase.getTitle(), testCase.getStatusCode());
}
pageNumber++;
} while (testCases.size() == pageSize);
Sample Request XML
POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: text/xml; charset=utf-8
Content-Length: 1034 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/TestCases_LoadByCriteria"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<TestCases_LoadByCriteria xmlns="http://www.pragmaticsw.com/">
<AuthenticationData>
<AppCode>agSP</AppCode>
<DeptId>7154</DeptId>
<ProjId>1032</ProjId>
<UserId>25315</UserId>
<PassCode>p@ssword</PassCode>
</AuthenticationData>
<Condition>
<![CDATA[<Conditions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
Operation='opEQU'>
<Items Type='tField'>
<Value xsi:type='xsd:string'>StatusCode</Value>
</Items>
<Items Type='tString'>
<Value xsi:type='xsd:string'>Failed</Value>
</Items>
</Conditions>]]>
</Condition>
<Sorting>Title</Sorting>
<PageSize>200</PageSize>
<PageNumber>1</PageNumber>
</TestCases_LoadByCriteria>
</soap:Body>
</soap:Envelope>
SOAP 1.2
POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 1042 {Insert an appropriate value here}
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<TestCases_LoadByCriteria xmlns="http://www.pragmaticsw.com/">
<AuthenticationData>
<AppCode>agSP</AppCode>
<DeptId>7154</DeptId>
<ProjId>1032</ProjId>
<UserId>25315</UserId>
<PassCode>p@ssword</PassCode>
</AuthenticationData>
<Condition>
<![CDATA[<Conditions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
Operation='opEQU'>
<Items Type='tField'>
<Value xsi:type='xsd:string'>StatusCode</Value>
</Items>
<Items Type='tString'>
<Value xsi:type='xsd:string'>Failed</Value>
</Items>
</Conditions>]]>
</Condition>
<Sorting>Title</Sorting>
<PageSize>200</PageSize>
<PageNumber>1</PageNumber>
</TestCases_LoadByCriteria>
</soap12:Body>
</soap12:Envelope>
Sample Response XML
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 2803 {The server returns an appropriate value here}
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<TestCases_LoadByCriteriaResponse xmlns="http://www.pragmaticsw.com/">
<TestCases_LoadByCriteriaResult>
<TestCase>
<TestCaseId>156</TestCaseId>
<Title>Test internal text editor</Title>
<StatusCode>Failed</StatusCode>
<FunctSpecId>6666</FunctSpecId>
<Steps>
<![CDATA[<ol><li>Click Tools > Notepad.</li><li>Enter "Test text".</li><li>Close the Notepad dialog.</li></ol>]]>
</Steps>
<ExpectedResults>ffer to save the text must be shown.A t</ExpectedResults>
<OwnerUserId>27572</OwnerUserId>
<AssigneeUserId>27942</AssigneeUserId>
<EstHrs>0.083</EstHrs>
<EstStart>2014-06-10T10:00:00</EstStart>
<EstFinish>2014-06-10T10:05:00</EstFinish>
<PctComplete>100</PctComplete>
<ActHrs>0.000</ActHrs>
<ActualStart>2014-06-10T12:15:45</ActualStart>
<ActFinish>2014-06-10T12:14:21</ActFinish>
<EstHrsRemaining>0.000</EstHrsRemaining>
<ActualResults>The offering is not displayed.</ActualResults>
<AssignedToName>Doe, John</AssignedToName>
<DateCreated>2014-05-30T14:01:51.057</DateCreated>
<DateUpdated>2014-06-10T12:15:16</DateUpdated>
<FolderName>FamilyAlbum/Release 1.1/Iteration 1</FolderName>
<ImportId>0</ImportId>
<NbrFiles>0</NbrFiles>
<NbrNotes>0</NbrNotes>
<NbrTasks>0</NbrTasks>
<OwnerName>Davis, Eugeny</OwnerName>
<ProjId>17823</ProjId>
<UpdateUserId>27942</UpdateUserId>
<UserName>Doe, John</UserName>
</TestCase>
<TestCase>
<TestCaseId>388</TestCaseId>
<Title>Open attached text file</Title>
<StatusCode>Failed</StatusCode>
<FunctSpecId>8966</FunctSpecId>
<Steps>
<![CDATA[<ol><li>Click <b>Linked Items</b></li><li>Open TestFile.txt.</li></ol>]]>
</Steps>
<ExpectedResults>ext file opens in the internal text editor.</ExpectedResults>
<OwnerUserId>27572</OwnerUserId>
<AssigneeUserId>27534</AssigneeUserId>
<EstHrs>0.041</EstHrs>
<EstStart>2014-06-12T15:30:00</EstStart>
<EstFinish>2014-06-12T15:35:00</EstFinish>
<PctComplete>100</PctComplete>
<ActHrs>0.000</ActHrs>
<ActualStart>2014-06-12T16:14:24</ActualStart>
<ActFinish>2014-06-12T16:15:12</ActFinish>
<EstHrsRemaining></EstHrsRemaining>
<ActualResults>The text editor runs, but the text file is not opened.</ActualResults>
<AssignedToName>Fry, Alex</AssignedToName>
<DateCreated>2014-05-30T13:57:48.024</DateCreated>
<DateUpdated>2014-06-12T16:17:48</DateUpdated>
<FolderName>FamilyAlbum/Release 1.1/Iteration 1/Build 3432</FolderName>
<ImportId>0</ImportId>
<NbrFiles>0</NbrFiles>
<NbrNotes>0</NbrNotes>
<NbrTasks>0</NbrTasks>
<OwnerName>Davis, Eugeny</OwnerName>
<ProjId>17823</ProjId>
<UpdateUserId>27534</UpdateUserId>
<UserName>Fry, Alex</UserName>
</TestCase>
</TestCases_LoadByCriteriaResult>
</TestCases_LoadByCriteriaResponse>
</soap:Body>
</soap:Envelope>
SOAP 1.2
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 2813 {The server returns an appropriate value here}
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<TestCases_LoadByCriteriaResponse xmlns="http://www.pragmaticsw.com/">
<TestCases_LoadByCriteriaResult>
<TestCase>
<TestCaseId>156</TestCaseId>
<Title>Test internal text editor</Title>
<StatusCode>Failed</StatusCode>
<FunctSpecId>6666</FunctSpecId>
<Steps>
<![CDATA[<ol><li>Click Tools > Notepad.</li><li>Enter "Test text".</li><li>Close the Notepad dialog.</li></ol>]]>
</Steps>
<ExpectedResults>ffer to save the text must be shown.A t</ExpectedResults>
<OwnerUserId>27572</OwnerUserId>
<AssigneeUserId>27942</AssigneeUserId>
<EstHrs>0.083</EstHrs>
<EstStart>2014-06-10T10:00:00</EstStart>
<EstFinish>2014-06-10T10:05:00</EstFinish>
<PctComplete>100</PctComplete>
<ActHrs>0.000</ActHrs>
<ActualStart>2014-06-10T12:15:45</ActualStart>
<ActFinish>2014-06-10T12:14:21</ActFinish>
<EstHrsRemaining>0.000</EstHrsRemaining>
<ActualResults>The offering is not displayed.</ActualResults>
<AssignedToName>Doe, John</AssignedToName>
<DateCreated>2014-05-30T14:01:51.057</DateCreated>
<DateUpdated>2014-06-10T12:15:16</DateUpdated>
<FolderName>FamilyAlbum/Release 1.1/Iteration 1</FolderName>
<ImportId>0</ImportId>
<NbrFiles>0</NbrFiles>
<NbrNotes>0</NbrNotes>
<NbrTasks>0</NbrTasks>
<OwnerName>Davis, Eugeny</OwnerName>
<ProjId>17823</ProjId>
<UpdateUserId>27942</UpdateUserId>
<UserName>Doe, John</UserName>
</TestCase>
<TestCase>
<TestCaseId>388</TestCaseId>
<Title>Open attached text file</Title>
<StatusCode>Failed</StatusCode>
<FunctSpecId>8966</FunctSpecId>
<Steps>
<![CDATA[<ol><li>Click <b>Linked Items</b></li><li>Open TestFile.txt.</li></ol>]]>
</Steps>
<ExpectedResults>ext file opens in the internal text editor.</ExpectedResults>
<OwnerUserId>27572</OwnerUserId>
<AssigneeUserId>27534</AssigneeUserId>
<EstHrs>0.041</EstHrs>
<EstStart>2014-06-12T15:30:00</EstStart>
<EstFinish>2014-06-12T15:35:00</EstFinish>
<PctComplete>100</PctComplete>
<ActHrs>0.000</ActHrs>
<ActualStart>2014-06-12T16:14:24</ActualStart>
<ActFinish>2014-06-12T16:15:12</ActFinish>
<EstHrsRemaining></EstHrsRemaining>
<ActualResults>The text editor runs, but the text file is not opened.</ActualResults>
<AssignedToName>Fry, Alex</AssignedToName>
<DateCreated>2014-05-30T13:57:48.024</DateCreated>
<DateUpdated>2014-06-12T16:17:48</DateUpdated>
<FolderName>FamilyAlbum/Release 1.1/Iteration 1/Build 3432</FolderName>
<ImportId>0</ImportId>
<NbrFiles>0</NbrFiles>
<NbrNotes>0</NbrNotes>
<NbrTasks>0</NbrTasks>
<OwnerName>Davis, Eugeny</OwnerName>
<ProjId>17823</ProjId>
<UpdateUserId>27534</UpdateUserId>
<UserName>Fry, Alex</UserName>
</TestCase>
</TestCases_LoadByCriteriaResult>
</TestCases_LoadByCriteriaResponse>
</soap12:Body>
</soap12:Envelope>
See Also
TestCases_Add
TestCases_Delete
TestCases_Load
TestCases_LoadByUNC
TestCases_Update
Test Cases Operations (Releases 9.6.0 and Earlier)
SOAP API Reference