TestSteps_LoadByCriteria Operation

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

Returns an array of TestStep objects that meet the specified condition. If no condition is specified, the method returns all test steps in all tests 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 steps 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 steps from one or several projects. To specify a project to get test steps from, use the ProjId value in the AuthenticationData object in the request body. To get test steps 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 Library.

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) that contains the tests whose steps you want to get.

Condition  :  string, required

A condition (in XML format) the tests should meet. Wrap the condition into the CDATA tag or encode XML entities.

If you do not specify a condition, the method will return all steps in all tests in the Test Library.

Sorting  :  string, required

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

PageSize  :  integer, required

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

PageNumber  :  integer, required

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

Result

An array of the TestStep 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'>TestIds</Value>
          </Items>
          <Items Type='tString'>
            <Value xsi:type='xsd:string'>1</Value>
          </Items>
        </Conditions>";

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

// Get the array of test steps
TestStep[] steps = new TestStep[0];
do
{
  steps = service.TestSteps_LoadByCriteria(authData, condition, sorting, pageSize, pageNumber);
    foreach (TestStep step in steps)
    {
      // Printing the ordinal number and instructions of each test
      Console.WriteLine("{0}: {1}", step.Seq, step.Step);
    }
  pageNumber++;
}
while (steps.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'>TestId</Value> \n" +
          "  </Items> \n" +
          "  <Items Type='tString'> \n" +
          "    <Value xsi:type='xsd:string'>1</Value> \n" +
          "  </Items> \n" +
          "</Conditions>";

// Specify the sorting
String sorting = "Seq";
// Specify the number of test steps on a page
int pageSize = 200;
// Specify the number of a page
int pageNumber = 1;
// Get the array of test steps
List<TestStep> steps;
do
{
  steps = service.testStepsLoadByCriteria(authData, condition, sorting, pageSize, pageNumber).getTestStep();
  for (TestStep step : steps)
  {
    // Printing the ordinal number and instructions of each test
    System.out.format("%d: %s%n", step.getSeq(), step.getStep());
  }
  pageNumber++;
}
while (steps.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: 895 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/TestSteps_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>
    <TestSteps_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;TestId&lt;/Value&gt; &#xD;
          &lt;/Items&gt; &#xD;
          &lt;Items Type='tString'&gt; &#xD;
            &lt;Value xsi:type='xsd:string'&gt;1&lt;/Value&gt; &#xD;
          &lt;/Items&gt; &#xD;
&lt;/Conditions&gt;
</Condition>
      <Sorting>Seq</Sorting>
      <PageSize>200</PageSize>
      <PageNumber>1</PageNumber>
    </TestSteps_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: 903 {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>
    <TestSteps_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;TestId&lt;/Value&gt; &#xD;
          &lt;/Items&gt; &#xD;
          &lt;Items Type='tString'&gt; &#xD;
            &lt;Value xsi:type='xsd:string'&gt;1&lt;/Value&gt; &#xD;
          &lt;/Items&gt; &#xD;
&lt;/Conditions&gt;
</Condition>
      <Sorting>Seq</Sorting>
      <PageSize>200</PageSize>
      <PageNumber>1</PageNumber>
    </TestSteps_LoadByCriteria>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 1457 {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>
    <TestSteps_LoadByCriteriaResponse xmlns="http://www.pragmaticsw.com/">
      <TestSteps_LoadByCriteriaResult>
        <TestStep>
          <TestId>1</TestId>
          <TestStepId>10</TestStepId>
          <Title>Test Tools dialog</Title>
          <Seq>1</Seq>
          <IsStoppedOnFail>Y</IsStoppedOnFail>
          <Step>Select Tools from the application's main menu.</Step>
          <ExpectedResults>The Tools dialog opens.</ExpectedResults>
          <DateCreated>2014-07-18T08:00:00</DateCreated>
          <DateUpdated>2014-07-21T10:30:00</DateUpdated>
          <CreateUserId>24661</CreateUserId>
          <UpdateUserId>24661</UpdateUserId>
          <ScriptName></ScriptName>
          <NbrFiles>0</NbrFiles>
          <ScriptSourceId>0</ScriptSourceId>
        </TestStep>
        <TestStep>
          <TestId>1</TestId>
          <TestStepId>11</TestStepId>
          <Title>Test Tools dialog</Title>
          <Seq>2</Seq>
          <IsStoppedOnFail>N</IsStoppedOnFail>
          <Step>Switch to the Java tabbed page.</Step>
          <ExpectedResults>The Java tabbed page shows the path to the Java Virtual machine module.</ExpectedResults>
          <DateCreated>2014-07-18T08:03:00</DateCreated>
          <DateUpdated>2014-07-21T10:40:00</DateUpdated>
          <CreateUserId>24661</CreateUserId>
          <UpdateUserId>24661</UpdateUserId>
          <ScriptName></ScriptName>
          <NbrFiles>0</NbrFiles>
          <ScriptSourceId>0</ScriptSourceId>
        </TestStep>
      </TestSteps_LoadByCriteriaResult>
    </TestSteps_LoadByCriteriaResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 1467 {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>
    <TestSteps_LoadByCriteriaResponse xmlns="http://www.pragmaticsw.com/">
      <TestSteps_LoadByCriteriaResult>
        <TestStep>
          <TestId>1</TestId>
          <TestStepId>10</TestStepId>
          <Title>Test Tools dialog</Title>
          <Seq>1</Seq>
          <IsStoppedOnFail>Y</IsStoppedOnFail>
          <Step>Select Tools from the application's main menu.</Step>
          <ExpectedResults>The Tools dialog opens.</ExpectedResults>
          <DateCreated>2014-07-18T08:00:00</DateCreated>
          <DateUpdated>2014-07-21T10:30:00</DateUpdated>
          <CreateUserId>24661</CreateUserId>
          <UpdateUserId>24661</UpdateUserId>
          <ScriptName></ScriptName>
          <NbrFiles>0</NbrFiles>
          <ScriptSourceId>0</ScriptSourceId>
        </TestStep>
        <TestStep>
          <TestId>1</TestId>
          <TestStepId>11</TestStepId>
          <Title>Test Tools dialog</Title>
          <Seq>2</Seq>
          <IsStoppedOnFail>N</IsStoppedOnFail>
          <Step>Switch to the Java tabbed page.</Step>
          <ExpectedResults>The Java tabbed page shows the path to the Java Virtual machine module.</ExpectedResults>
          <DateCreated>2014-07-18T08:03:00</DateCreated>
          <DateUpdated>2014-07-21T10:40:00</DateUpdated>
          <CreateUserId>24661</CreateUserId>
          <UpdateUserId>24661</UpdateUserId>
          <ScriptName></ScriptName>
          <NbrFiles>0</NbrFiles>
          <ScriptSourceId>0</ScriptSourceId>
        </TestStep>
      </TestSteps_LoadByCriteriaResult>
    </TestSteps_LoadByCriteriaResponse>
  </soap12:Body>
</soap12:Envelope>

See Also

TestSteps_Add
TestSteps_Delete
TestSteps_Load
TestSteps_Update
Test Management Operations
Test Step Operations
SOAP API Reference

Highlight search results