TestSets_LoadByCriteria Operation

Applies to QAComplete 14.3, last modified on February 19, 2024

Returns an array of TestSet objects that meet the specified condition. If no condition is specified, the method returns all test sets in the specified projects.

The method returns results in pages (subsets of data) rather than all at once. The number of pages and the number of test sets each page contains is controlled by the PageSize and PageNumber parameters. For information about working with pages, see LoadByCriteria Operations.

The operation can get test sets from one or several projects. To specify a project to get test sets from, use the ProjId value in the AuthenticationData object in the request body. To get test sets from several projects, use the ProjIds value in the AuthenticationData object to specify the list of project IDs.

Requirements

The user must belong to a security group that has the Read privilege for Test Management > Test Sets.

Parameters

The operation uses the following parameters:

AuthenticationData  :  object, required

An AuthenticationData object with the login information and the ID of the project (or the list of project IDs) whose test sets you want to get.

Condition  :  string, required

A condition (in XML format) the test sets must meet. Wrap the condition into the CDATA tag or encode XML entities.

If you do not specify a condition, the method will return all test sets in your project.

Sorting  :  string, required

Specifies a property by which the method will sort the test sets. If you do not specify any property for sorting, the method will sort the tests by ID.

PageSize  :  integer, required

Specifies how many test sets a single page contains (from 1 to 200).

PageNumber  :  integer, required

Specifies the number of the page from which you want to get test sets.

Result

An array of the TestSet objects that meet the criteria.

Example

Sample Code

C#

string login = "[email protected]";
string password = "p@ssword";

ServiceSoapClient service = new ServiceSoapClient();

// Prepare 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 = loginInfo.ProjId;

// Specify 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'>AssigneeUserId</Value>
          </Items>
          <Items Type='tString'>
            <Value xsi:type='xsd:string'>24661</Value>
          </Items>
        </Conditions>";

// Specify the sorting
string sorting = "TestSetId";
// Specify the number of test sets on a page
int pageSize = 200;
// Specify the number of a page
int pageNumber = 1;

// Get the array of test sets
TestSet[] sets = new TestSet[0];
do
{
  sets = service.TestSets_LoadByCriteria(authData, condition, sorting, pageSize, pageNumber);
    foreach (TestSet set in sets)
    {
      // Printing ID and title of each test set
      Console.WriteLine("{0}: {1}", set.TestSetId, set.Title);
    }
  pageNumber++;
}
while (sets.Length == pageSize);

Java

String login = "[email protected]";
String password = "p@ssword";

ServiceSoap service = new Service().getServiceSoap12();

// Prepare 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(loginInfo.getProjId());

// Specify the condition
String condition =
          "<Conditions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\n" +
          "  xmlns:xsd='http://www.w3.org/2001/XMLSchema' Operation='opEQU'> \n" +
          "  <Items Type='tField'> \n" +
          "    <Value xsi:type='xsd:string'>AssigneeUserId</Value> \n" +
          "  </Items> \n" +
          "  <Items Type='tString'> \n" +
          "    <Value xsi:type='xsd:string'>24661</Value> \n" +
          "  </Items> \n" +
          "</Conditions>";

// Specify the sorting
String sorting = "TestSetId";
// Specify the number of test sets on a page
int pageSize = 200;
// Specify the number of a page
int pageNumber = 1;
// Get the array of test sets
List<TestSet> sets;
do
{
  sets = service.testSetsLoadByCriteria(authData, condition, sorting, pageSize, pageNumber).getTestSet();
  for (TestSet set : sets)
  {
    // Printing ID and title of each test set
    System.out.format("%d: %s%n", set.getTestSetId(), set.getTitle());
  }
  pageNumber++;
}
while (sets.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: 911 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/TestSets_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>
    <TestSets_LoadByCriteria xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
      </AuthenticationData>
      <Condition> &lt;Conditions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'&#xD;
          xmlns:xsd='http://www.w3.org/2001/XMLSchema' Operation='opEQU'&gt;&#xD;
          &lt;Items Type='tField'&gt; &#xD;
            &lt;Value xsi:type='xsd:string'&gt;AssigneeUserId&lt;/Value&gt; &#xD;
          &lt;/Items&gt; &#xD;
          &lt;Items Type='tString'&gt; &#xD;
            &lt;Value xsi:type='xsd:string'&gt;24661&lt;/Value&gt; &#xD;
          &lt;/Items&gt; &#xD;
&lt;/Conditions&gt;
</Condition>
      <Sorting>TestSetId</Sorting>
      <PageSize>200</PageSize>
      <PageNumber>1</PageNumber>
    </TestSets_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: 919 {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>
    <TestSets_LoadByCriteria xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
      </AuthenticationData>
      <Condition> &lt;Conditions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'&#xD;
          xmlns:xsd='http://www.w3.org/2001/XMLSchema' Operation='opEQU'&gt;&#xD;
          &lt;Items Type='tField'&gt; &#xD;
            &lt;Value xsi:type='xsd:string'&gt;AssigneeUserId&lt;/Value&gt; &#xD;
          &lt;/Items&gt; &#xD;
          &lt;Items Type='tString'&gt; &#xD;
            &lt;Value xsi:type='xsd:string'&gt;24661&lt;/Value&gt; &#xD;
          &lt;/Items&gt; &#xD;
&lt;/Conditions&gt;
</Condition>
      <Sorting>TestSetId</Sorting>
      <PageSize>200</PageSize>
      <PageNumber>1</PageNumber>
    </TestSets_LoadByCriteria>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 3481 {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>
    <TestSets_LoadByCriteriaResponse xmlns="http://www.pragmaticsw.com/">
      <TestSets_LoadByCriteriaResult>
        <TestSet>
          <TestSetId>1</TestSetId>
          <ProjId>11873</ProjId>
          <FolderId>12</FolderId>
          <CreateUserId>24661</CreateUserId>
          <UpdateUserId>24661</UpdateUserId>
          <OriginalId>0</OriginalId>
          <ImportId>0</ImportId>
          <OwnerUserId>24661</OwnerUserId>
          <AssigneeUserId>24661</AssigneeUserId>
          <Title>Regression Tests - Release 3.1.0</Title>
          <IsActive>Y</IsActive>
          <IsSequential>Y</IsSequential>
          <StatusCode>Approved</StatusCode>
          <PriorityCode>1-High</PriorityCode>
          <ExecutionType>Manual</ExecutionType>
          <DateCreated>2014-07-17T08:30:28</DateCreated>
          <DateUpdated>2014-07-20T10:53:07</DateUpdated>
          <EstStart>0001-01-01T00:00:00</EstStart>
          <EstFinish>0001-01-01T00:00:00</EstFinish>
          <ActStart>0001-01-01T00:00:00</ActStart>
          <ActFinish>0001-01-01T00:00:00</ActFinish>
          <FolderName>Regression Tests</FolderName>
          <AssignedToName>Doe, John</AssignedToName>
          <UserName>Doe, John</UserName>
          <OwnerName>Doe, John</OwnerName>
          <NbrTests>6</NbrTests>
          <LastRunStatus>Passed</LastRunStatus>
          <LastRunDate>2014-07-20T10:53:07</LastRunDate>
          <LastRunByUserId>24661</LastRunByUserId>
          <LastRunByUserName>Doe, John</LastRunByUserName>
          <NbrTimesRun>3</NbrTimesRun>
          <AvgRunTime>1323</AvgRunTime>
          <AvgRunTimeFormated>00:22:03</AvgRunTimeFormated>
          <NbrEscalations>0</NbrEscalations>
          <DateLastEscalated>0001-01-01T00:00:00</DateLastEscalated>
          <LastEscalationRuleId>0</LastEscalationRuleId>
          <NbrFilesNotSecured>0</NbrFilesNotSecured>
          <NbrFiles>0</NbrFiles>
          <NbrNotes>0</NbrNotes>
          <NbrEvents>0</NbrEvents>
          <PctComplete>0</PctComplete>
          <EstHrs>0.000</EstHrs>
          <ActHrs>0.000</ActHrs>
          <EstHrsRemaining>0.000</EstHrsRemaining>
        </TestSet>
        <TestSet>
          <TestSetId>2</TestSetId>
          <ProjId>11873</ProjId>
          <FolderId>21</FolderId>
          <CreateUserId>24661</CreateUserId>
          <UpdateUserId>24667</UpdateUserId>
          <OriginalId>0</OriginalId>
          <ImportId>0</ImportId>
          <OwnerUserId>24661</OwnerUserId>
          <AssigneeUserId>24661</AssigneeUserId>
          <Title>New Features</Title>
          <IsActive>Y</IsActive>
          <IsSequential>N</IsSequential>
          <StatusCode>Awaiting Approval</StatusCode>
          <PriorityCode>2-Medium</PriorityCode>
          <ExecutionType>Automatic</ExecutionType>
          <DateCreated>2014-07-18T10:13:16</DateCreated>
          <DateUpdated>2014-07-22T11:14:18</DateUpdated>
          <EstStart>0001-01-01T00:00:00</EstStart>
          <EstFinish>0001-01-01T00:00:00</EstFinish>
          <ActStart>0001-01-01T00:00:00</ActStart>
          <ActFinish>0001-01-01T00:00:00</ActFinish>
          <FolderName>Automated Tests</FolderName>
          <AssignedToName>Doe, John</AssignedToName>
          <UserName>Doe, John</UserName>
          <OwnerName>Doe, John</OwnerName>
          <NbrTests>10</NbrTests>
          <LastRunStatus>Passed</LastRunStatus>
          <LastRunDate>2014-07-22T11:14:18</LastRunDate>
          <LastRunByUserId>24667</LastRunByUserId>
          <LastRunByUserName>Doe, Jane</LastRunByUserName>
          <NbrTimesRun>8</NbrTimesRun>
          <AvgRunTime>746</AvgRunTime>
          <AvgRunTimeFormated>00:12:26</AvgRunTimeFormated>
          <NbrEscalations>0</NbrEscalations>
          <DateLastEscalated>0001-01-01T00:00:00</DateLastEscalated>
          <LastEscalationRuleId>0</LastEscalationRuleId>
          <NbrFilesNotSecured>0</NbrFilesNotSecured>
          <NbrFiles>0</NbrFiles>
          <NbrNotes>0</NbrNotes>
          <NbrEvents>0</NbrEvents>
          <PctComplete>0</PctComplete>
          <EstHrs>0.000</EstHrs>
          <ActHrs>0.000</ActHrs>
          <EstHrsRemaining>0.000</EstHrsRemaining>
        </TestSet>
      </TestSets_LoadByCriteriaResult>
    </TestSets_LoadByCriteriaResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 3491 {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>
    <TestSets_LoadByCriteriaResponse xmlns="http://www.pragmaticsw.com/">
      <TestSets_LoadByCriteriaResult>
        <TestSet>
          <TestSetId>1</TestSetId>
          <ProjId>11873</ProjId>
          <FolderId>12</FolderId>
          <CreateUserId>24661</CreateUserId>
          <UpdateUserId>24661</UpdateUserId>
          <OriginalId>0</OriginalId>
          <ImportId>0</ImportId>
          <OwnerUserId>24661</OwnerUserId>
          <AssigneeUserId>24661</AssigneeUserId>
          <Title>Regression Tests - Release 3.1.0</Title>
          <IsActive>Y</IsActive>
          <IsSequential>Y</IsSequential>
          <StatusCode>Approved</StatusCode>
          <PriorityCode>1-High</PriorityCode>
          <ExecutionType>Manual</ExecutionType>
          <DateCreated>2014-07-17T08:30:28</DateCreated>
          <DateUpdated>2014-07-20T10:53:07</DateUpdated>
          <EstStart>0001-01-01T00:00:00</EstStart>
          <EstFinish>0001-01-01T00:00:00</EstFinish>
          <ActStart>0001-01-01T00:00:00</ActStart>
          <ActFinish>0001-01-01T00:00:00</ActFinish>
          <FolderName>Regression Tests</FolderName>
          <AssignedToName>Doe, John</AssignedToName>
          <UserName>Doe, John</UserName>
          <OwnerName>Doe, John</OwnerName>
          <NbrTests>6</NbrTests>
          <LastRunStatus>Passed</LastRunStatus>
          <LastRunDate>2014-07-20T10:53:07</LastRunDate>
          <LastRunByUserId>24661</LastRunByUserId>
          <LastRunByUserName>Doe, John</LastRunByUserName>
          <NbrTimesRun>3</NbrTimesRun>
          <AvgRunTime>1323</AvgRunTime>
          <AvgRunTimeFormated>00:22:03</AvgRunTimeFormated>
          <NbrEscalations>0</NbrEscalations>
          <DateLastEscalated>0001-01-01T00:00:00</DateLastEscalated>
          <LastEscalationRuleId>0</LastEscalationRuleId>
          <NbrFilesNotSecured>0</NbrFilesNotSecured>
          <NbrFiles>0</NbrFiles>
          <NbrNotes>0</NbrNotes>
          <NbrEvents>0</NbrEvents>
          <PctComplete>0</PctComplete>
          <EstHrs>0.000</EstHrs>
          <ActHrs>0.000</ActHrs>
          <EstHrsRemaining>0.000</EstHrsRemaining>
        </TestSet>
        <TestSet>
          <TestSetId>2</TestSetId>
          <ProjId>11873</ProjId>
          <FolderId>21</FolderId>
          <CreateUserId>24661</CreateUserId>
          <UpdateUserId>24667</UpdateUserId>
          <OriginalId>0</OriginalId>
          <ImportId>0</ImportId>
          <OwnerUserId>24661</OwnerUserId>
          <AssigneeUserId>24661</AssigneeUserId>
          <Title>New Features</Title>
          <IsActive>Y</IsActive>
          <IsSequential>N</IsSequential>
          <StatusCode>Awaiting Approval</StatusCode>
          <PriorityCode>2-Medium</PriorityCode>
          <ExecutionType>Automatic</ExecutionType>
          <DateCreated>2014-07-18T10:13:16</DateCreated>
          <DateUpdated>2014-07-22T11:14:18</DateUpdated>
          <EstStart>0001-01-01T00:00:00</EstStart>
          <EstFinish>0001-01-01T00:00:00</EstFinish>
          <ActStart>0001-01-01T00:00:00</ActStart>
          <ActFinish>0001-01-01T00:00:00</ActFinish>
          <FolderName>Automated Tests</FolderName>
          <AssignedToName>Doe, John</AssignedToName>
          <UserName>Doe, John</UserName>
          <OwnerName>Doe, John</OwnerName>
          <NbrTests>10</NbrTests>
          <LastRunStatus>Passed</LastRunStatus>
          <LastRunDate>2014-07-22T11:14:18</LastRunDate>
          <LastRunByUserId>24667</LastRunByUserId>
          <LastRunByUserName>Doe, Jane</LastRunByUserName>
          <NbrTimesRun>8</NbrTimesRun>
          <AvgRunTime>746</AvgRunTime>
          <AvgRunTimeFormated>00:12:26</AvgRunTimeFormated>
          <NbrEscalations>0</NbrEscalations>
          <DateLastEscalated>0001-01-01T00:00:00</DateLastEscalated>
          <LastEscalationRuleId>0</LastEscalationRuleId>
          <NbrFilesNotSecured>0</NbrFilesNotSecured>
          <NbrFiles>0</NbrFiles>
          <NbrNotes>0</NbrNotes>
          <NbrEvents>0</NbrEvents>
          <PctComplete>0</PctComplete>
          <EstHrs>0.000</EstHrs>
          <ActHrs>0.000</ActHrs>
          <EstHrsRemaining>0.000</EstHrsRemaining>
        </TestSet>
      </TestSets_LoadByCriteriaResult>
    </TestSets_LoadByCriteriaResponse>
  </soap12:Body>
</soap12:Envelope>

See Also

TestSets_Add
TestSets_Delete
TestSets_Load
TestSets_Update
Test Management Operations
Test Set Operations
SOAP API Reference

Highlight search results