AutomationRuns_LoadByCriteria Operation

Applies to QAComplete 14.3, last modified on February 19, 2024
This functionality is provided by the automated testing bridge that allows obtaining TestComplete test results to the QAComplete Automation screen.
Starting from the release 9.9.0, this functionality is obsolete and is supported only for backward compatibility.

Returns an array of AutomationRun objects that meet the specified condition. If no condition is specified, the method returns all automated test runs registered in the specified projects.

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

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

Requirements

The user must belong to a security group that has the Read privilege for Automation Runs.

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 automated test runs you want to get.

Condition  :  string, required

A condition (in XML format) the automated test runs must meet. For the syntax and examples, see Condition Syntax.

If you create SOAP requests manually, place the condition string inside CDATA.

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

Sorting  :  string, required

The order to sort the results before returning them from the web service. For example, by test run ID or number of failed tests. The format is:

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

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

Example values:

AutomationTestItemId
AutomationHostId, FullTestName
NbrFailed DESC

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

PageSize  :  integer, required

Limits the number of automated test runs 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 automated test runs 1..100, PageNumber of 2 – automated test runs 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 the AutomationRun 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'>Status</Value>
          </Items>
          <Items Type='tString'>
            <Value xsi:type='xsd:string'>Passed</Value>
          </Items>
        </Conditions>";

// Specify the sorting
string sorting = "StartTime";
// Specify the number of items on a page
int pageSize = 200;
// Specify the number of a page
int pageNumber = 1;

// Get the array of runs
AutomationRun[] runs = new AutomationRun[0];
do
{
  runs = service.AutomationRuns_LoadByCriteria(authData, condition, sorting, pageSize, pageNumber);
    foreach (AutomationRun run in runs)
    {
      // Printing the ID and name of each run
      Console.WriteLine("{0}: {1}", run.AutomationRunId, run.FullTestName);
    }
  pageNumber++;
}
while (runs.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'>Status</Value> \n" +
          "  </Items> \n" +
          "  <Items Type='tString'> \n" +
          "    <Value xsi:type='xsd:string'>Passed</Value> \n" +
          "  </Items> \n" +
          "</Conditions>";

// Specify the sorting
String sorting = "StartTime";
// Specify the number of items on a page
int pageSize = 200;
// Specify the number of a page
int pageNumber = 1;
List<AutomationRun> runs;
do
{
  runs = service.automationRunsLoadByCriteria(authData, condition, sorting, pageSize, pageNumber).getAutomationRun();
  for (AutomationRun run : runs)
  {
    // Printing the ID and name of each run
    System.out.format("%d: %s%n", run.getAutomationRunId(), run.getFullTestName());
  }
  pageNumber++;
}
while (runs.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: 916 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/AutomationRuns_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>
    <AutomationRuns_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;Status&lt;/Value&gt; &#xD;
          &lt;/Items&gt; &#xD;
          &lt;Items Type='tString'&gt; &#xD;
            &lt;Value xsi:type='xsd:string'&gt;Passed&lt;/Value&gt; &#xD;
          &lt;/Items&gt; &#xD;
&lt;/Conditions&gt;
</Condition>
      <Sorting>StartTime</Sorting>
      <PageSize>200</PageSize>
      <PageNumber>1</PageNumber>
    </AutomationRuns_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: 924 {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>
    <AutomationRuns_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;Status&lt;/Value&gt; &#xD;
          &lt;/Items&gt; &#xD;
          &lt;Items Type='tString'&gt; &#xD;
            &lt;Value xsi:type='xsd:string'&gt;Passed&lt;/Value&gt; &#xD;
          &lt;/Items&gt; &#xD;
&lt;/Conditions&gt;
</Condition>
      <Sorting>StartTime</Sorting>
      <PageSize>200</PageSize>
      <PageNumber>1</PageNumber>
    </AutomationRuns_LoadByCriteria>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 1811 {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>
    <AutomationRuns_LoadByCriteriaResponse xmlns="http://www.pragmaticsw.com/">
      <AutomationRuns_LoadByCriteriaResult>
        <AutomationRun>
          <AutomationRunId>1</AutomationRunId>
          <AutomationTestItemId>1</AutomationTestItemId>
          <AutomationHostId>1</AutomationHostId>
          <Status>Passed</Status>
          <FullTestName>Full Regression</FullTestName>
          <NbrTests>1</NbrTests>
          <NbrPassed>1</NbrPassed>
          <NbrFailed>0</NbrFailed>
          <DurationInSecs>36</DurationInSecs>
          <AutomationHostName>TestHost-WinXPx86</AutomationHostName>
          <FileId>132</FileId>
          <StartTime>2014-07-21T08:06:12</StartTime>
          <EndTime>2014-07-21T08:06:48</EndTime>
          <CreateUserId>24661</CreateUserId>
          <UpdateUserId>24661</UpdateUserId>
          <DateCreated>2014-07-21T08:06:48</DateCreated>
          <DateUpdated>2014-07-21T09:47:42</DateUpdated>
          <AutomationType>TestComplete</AutomationType>
        </AutomationRun>
        <AutomationRun>
          <AutomationRunId>2</AutomationRunId>
          <AutomationTestItemId>2</AutomationTestItemId>
          <AutomationHostId>1</AutomationHostId>
          <Status>Passed</Status>
          <FullTestName>Full Regression</FullTestName>
          <NbrTests>1</NbrTests>
          <NbrPassed>1</NbrPassed>
          <NbrFailed>0</NbrFailed>
          <DurationInSecs>42</DurationInSecs>
          <AutomationHostName>TestHost-WinVistax64</AutomationHostName>
          <FileId>156</FileId>
          <StartTime>2014-07-21T10:02:37</StartTime>
          <EndTime>2014-07-21T10:03:19</EndTime>
          <CreateUserId>24661</CreateUserId>
          <UpdateUserId>24661</UpdateUserId>
          <DateCreated>2014-07-21T10:03:19</DateCreated>
          <DateUpdated>2014-07-21T09:13:24</DateUpdated>
          <AutomationType>TestComplete</AutomationType>
        </AutomationRun>
      </AutomationRuns_LoadByCriteriaResult>
    </AutomationRuns_LoadByCriteriaResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 1821 {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>
    <AutomationRuns_LoadByCriteriaResponse xmlns="http://www.pragmaticsw.com/">
      <AutomationRuns_LoadByCriteriaResult>
        <AutomationRun>
          <AutomationRunId>1</AutomationRunId>
          <AutomationTestItemId>1</AutomationTestItemId>
          <AutomationHostId>1</AutomationHostId>
          <Status>Passed</Status>
          <FullTestName>Full Regression</FullTestName>
          <NbrTests>1</NbrTests>
          <NbrPassed>1</NbrPassed>
          <NbrFailed>0</NbrFailed>
          <DurationInSecs>36</DurationInSecs>
          <AutomationHostName>TestHost-WinXPx86</AutomationHostName>
          <FileId>132</FileId>
          <StartTime>2014-07-21T08:06:12</StartTime>
          <EndTime>2014-07-21T08:06:48</EndTime>
          <CreateUserId>24661</CreateUserId>
          <UpdateUserId>24661</UpdateUserId>
          <DateCreated>2014-07-21T08:06:48</DateCreated>
          <DateUpdated>2014-07-21T09:47:42</DateUpdated>
          <AutomationType>TestComplete</AutomationType>
        </AutomationRun>
        <AutomationRun>
          <AutomationRunId>2</AutomationRunId>
          <AutomationTestItemId>2</AutomationTestItemId>
          <AutomationHostId>1</AutomationHostId>
          <Status>Passed</Status>
          <FullTestName>Full Regression</FullTestName>
          <NbrTests>1</NbrTests>
          <NbrPassed>1</NbrPassed>
          <NbrFailed>0</NbrFailed>
          <DurationInSecs>42</DurationInSecs>
          <AutomationHostName>TestHost-WinVistax64</AutomationHostName>
          <FileId>156</FileId>
          <StartTime>2014-07-21T10:02:37</StartTime>
          <EndTime>2014-07-21T10:03:19</EndTime>
          <CreateUserId>24661</CreateUserId>
          <UpdateUserId>24661</UpdateUserId>
          <DateCreated>2014-07-21T10:03:19</DateCreated>
          <DateUpdated>2014-07-21T09:13:24</DateUpdated>
          <AutomationType>TestComplete</AutomationType>
        </AutomationRun>
      </AutomationRuns_LoadByCriteriaResult>
    </AutomationRuns_LoadByCriteriaResponse>
  </soap12:Body>
</soap12:Envelope>

See Also

AutomationRuns_Add
AutomationRuns_Delete
AutomationRuns_Load
AutomationRuns_Update
Automated Testing Bridge Operations
SOAP API Reference

Highlight search results