TestConfigurations_LoadByCriteria Operation

Applies to QAComplete 14.5, last modified on August 06, 2024

Use the TestConfigurations_LoadByCriteria operation to:

  • Get test configurations that match a specific condition. For example, created by a specific user or on a specific day.

  • Get all test configurations in QAComplete projects (if no condition is specified).

The operation can get test configurations from one or several projects. To specify a project to get test configurations from, use the ProjId value in the AuthenticationData object in the request body. To get test configurations 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 configurations before returning them from QAComplete.

To get just one test configuration, use TestConfigurations_Load.

Requirements

The authenticating user must belong to a user group that has the Read privilege for Test Library.

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 configurations.

Condition  :  string (max 65536 chars)

An XML-formatted string that describes the test configurations 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 test configurations, 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 configuration ID or last updated date. The format is:

Property1 [ASC | DESC ][, Property2 [ASC | DESC ]] [, ...]]]

where property names are those of the TestConfiguration object. If you omit ASC or DESC after a property name, test configurations are sorted in ascending order.

Example values:

ConfigId
AssignedToName, ConfigId
DateUpdated DESC

To keep the default sort order, use an empty string or a null value.

PageSize  :  integer, required

Limits the number of test configurations 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 configurations 1..100, PageNumber of 2 – test configurations 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 TestConfiguration objects that represents the test configurations.

Example

Sample Code

This example loads all active test configurations.

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'>IsActive</Value>
  </Items>
  <Items Type='tString'>
    <Value xsi:type='xsd:string'>Y</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;

TestConfiguration[] testConfigs = new TestConfiguration[0];
int pageNumber = 1;
do
{
  testConfigs = service.TestConfigurations_LoadByCriteria(authData, condition, Sorting, pageSize, pageNumber);
  foreach (TestConfiguration testConfig in testConfigs)
  {
    Console.WriteLine("Test Configuration: {0} ({1})", testConfig.ConfigurationName, testConfig.IsActive);
    }
} while (testConfigs.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'>IsActive</Value>\n" +
"  </Items>\n" +
"  <Items Type='tString'>\n" +
"    <Value xsi:type='xsd:string'>Y</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 the TestConfiguration objects
List<TestConfiguration> testConfigs;
int pageNumber = 1;

do
{
  testConfigs = service.testConfigurationsLoadByCriteria(authData, condition, sorting, pageSize, pageNumber).getTestConfiguration();
  for (TestConfiguration testConfig : testConfigs)
  {
    System.out.format("Loaded test configuration: %s (Active: %s)%n", testConfig.getConfigurationName(), testConfig.getIsActive());
  }
  pageNumber++;
} while (testConfigs.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: 1045 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/TestConfigurations_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>
    <TestConfigurations_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'>IsActive</Value>
          </Items>
          <Items Type='tString'>
            <Value xsi:type='xsd:string'>Y</Value>
          </Items>
        </Conditions>]]>
      
</Condition>
      <Sorting>Title</Sorting>
      <PageSize>200</PageSize>
      <PageNumber>1</PageNumber>
    </TestConfigurations_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: 1053 {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>
    <TestConfigurations_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'>IsActive</Value>
          </Items>
          <Items Type='tString'>
            <Value xsi:type='xsd:string'>Y</Value>
          </Items>
        </Conditions>]]>
      
</Condition>
      <Sorting>Title</Sorting>
      <PageSize>200</PageSize>
      <PageNumber>1</PageNumber>
    </TestConfigurations_LoadByCriteria>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 1644 {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>
    <TestConfigurations_LoadByCriteriaResponse xmlns="http://www.pragmaticsw.com/">
      <TestConfigurations_LoadByCriteriaResult>
        <TestConfiguration>
          <ConfigId>254</ConfigId>
          <ProjId>10372</ProjId>
          <ConfigurationName>Windows 7 (32-bit)</ConfigurationName>
          <Description>Standard Windows 7 (32-bit) system environment.</Description>
          <IsActive>Y</IsActive>
          <CreateUserId>27572</CreateUserId>
          <UpdateUserId>27942</UpdateUserId>
          <DateCreated>2014-07-24T09:12:08.037</DateCreated>
          <DateUpdated>2014-07-30T13:50:24.017</DateUpdated>
          <OwnerUserId>27572</OwnerUserId>
          <OriginalId>0</OriginalId>
          <ImportId>0</ImportId>
          <OwnerName>Davis, Eugeny</OwnerName>
          <UserName>Doe, John</UserName>
          <NbrFiles>0</NbrFiles>
          <NbrNotes>0</NbrNotes>
        </TestConfiguration>
        <TestConfiguration>
          <ConfigId>388</ConfigId>
          <ProjId>10372</ProjId>
          <ConfigurationName>Windows 8 (64-bit)</ConfigurationName>
          <Description>Standard Windows 8 (64-bit) system environment.</Description>
          <IsActive>Y</IsActive>
          <CreateUserId>27572</CreateUserId>
          <UpdateUserId>27534</UpdateUserId>
          <DateCreated>2014-07-27T12:17:37.069</DateCreated>
          <DateUpdated>2014-07-31T10:37:57.086</DateUpdated>
          <OwnerUserId>27572</OwnerUserId>
          <OriginalId>0</OriginalId>
          <ImportId>0</ImportId>
          <OwnerName>Davis, Eugeny</OwnerName>
          <UserName>Fry, Alex</UserName>
          <NbrFiles>0</NbrFiles>
          <NbrNotes>0</NbrNotes>
        </TestConfiguration>
      </TestConfigurations_LoadByCriteriaResult>
    </TestConfigurations_LoadByCriteriaResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 1654 {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>
    <TestConfigurations_LoadByCriteriaResponse xmlns="http://www.pragmaticsw.com/">
      <TestConfigurations_LoadByCriteriaResult>
        <TestConfiguration>
          <ConfigId>254</ConfigId>
          <ProjId>10372</ProjId>
          <ConfigurationName>Windows 7 (32-bit)</ConfigurationName>
          <Description>Standard Windows 7 (32-bit) system environment.</Description>
          <IsActive>Y</IsActive>
          <CreateUserId>27572</CreateUserId>
          <UpdateUserId>27942</UpdateUserId>
          <DateCreated>2014-07-24T09:12:08.037</DateCreated>
          <DateUpdated>2014-07-30T13:50:24.017</DateUpdated>
          <OwnerUserId>27572</OwnerUserId>
          <OriginalId>0</OriginalId>
          <ImportId>0</ImportId>
          <OwnerName>Davis, Eugeny</OwnerName>
          <UserName>Doe, John</UserName>
          <NbrFiles>0</NbrFiles>
          <NbrNotes>0</NbrNotes>
        </TestConfiguration>
        <TestConfiguration>
          <ConfigId>388</ConfigId>
          <ProjId>10372</ProjId>
          <ConfigurationName>Windows 8 (64-bit)</ConfigurationName>
          <Description>Standard Windows 8 (64-bit) system environment.</Description>
          <IsActive>Y</IsActive>
          <CreateUserId>27572</CreateUserId>
          <UpdateUserId>27534</UpdateUserId>
          <DateCreated>2014-07-27T12:17:37.069</DateCreated>
          <DateUpdated>2014-07-31T10:37:57.086</DateUpdated>
          <OwnerUserId>27572</OwnerUserId>
          <OriginalId>0</OriginalId>
          <ImportId>0</ImportId>
          <OwnerName>Davis, Eugeny</OwnerName>
          <UserName>Fry, Alex</UserName>
          <NbrFiles>0</NbrFiles>
          <NbrNotes>0</NbrNotes>
        </TestConfiguration>
      </TestConfigurations_LoadByCriteriaResult>
    </TestConfigurations_LoadByCriteriaResponse>
  </soap12:Body>
</soap12:Envelope>

See Also

TestConfigurations_Add
TestConfigurations_Delete
TestConfigurations_Load
TestConfigurations_Update
Test Management Operations
Test Configuration Operations
SOAP API Reference

Highlight search results