TestSteps_Add Operation

Applies to QAComplete 12.80 SaaS, last modified on April 20, 2021

Adds a new step to a test in the Test Library in QAComplete and returns the ID of the added step.

Requirements

The user must belong to a security group that has the Update privilege for Test Library.

Parameters

The operation uses the following parameters:

AuthenticationData  :  AuthenticationData, required

An AuthenticationData object containing the login information and the ID of the project that contains the test to which you want to add a step.

TestStep  :  TestStep, required

The TestStep object to add to a test in the Test Library.

SendEmailAlert  :  string, required

Y if you want to send an email alert; N otherwise.

Result

The ID of the added test step.

Remarks

The TestStep object you pass to the method must have the TestId and Step properties specified.

Example

Sample Code

This example creates a test with two steps.

C#

string login = "john.doe@example.com";
string password = "p@ssword";
int projID = 10372;

// Specifying test properties
string testTitle = "Test input data";
string testStatus = "New";

// Specifying steps properties
string[] Steps = {"Select Tools from the application's main menu.",
                  "Switch to the Java tabbed page."};
string[] expectedResults = {"The Tools dialog opens.",
                            "The Java tabbed page shows the path to the Java Virtual machine module."};
int[] Seqs = { 1, 2 };

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 = projID;

// Preparing a new test
Test test = new Test();
test.Title = testTitle;
test.StatusCode = testStatus;

// Add the test
int testId = service.Tests_Add(authData, test, "Y", "This test was added from code.");
Console.WriteLine("Id of the created test: {0}", testId);

for (int i = 0; i < 2; i++)
{
// Preparing the step objects
  TestStep step = new TestStep();
  step.TestId = testId;
  step.Step = Steps[i];
  step.ExpectedResult = expectedResults[i];
  step.Seq = Seqs[i];

  // Adding the step
  int stepId = service.TestSteps_Add(authData, step, "Y");
  Console.WriteLine("Step {0} was added to the test {1}", stepId, testId);
}

Java

String login = "john.doe@example.com";
String password = "p@ssword";
int projID = 10372;

// Specifying test properties
String testTitle = "Test input data";
String testStatus = "New";

// Specifying steps properties
String[] Steps = {"Select Tools from the application's main menu.",
        "Switch to the Java tabbed page."};
String[] expectedResults = {"The Tools dialog opens.",
        "The Java tabbed page shows the path to the Java Virtual machine module."};
int[] Seqs = { 1, 2 };

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 a new test
Test test = new Test();
test.setTitle(testTitle);
test.setStatusCode(testStatus);

// Adding the test
int testId = service.testsAdd(authData, test, "Y", "This test was added from code.");
System.out.format("Id of the created test: %d%n", testId);

for (int i = 0; i < 2; i++)
{
  // Preparing the step objects
  TestStep step = new TestStep();
  step.setTestId(testId);
  step.setStep(Steps[i]);
  step.setExpectedResult(expectedResults[i]);
  step.setSeq(Seqs[i]);

  // Adding the step
  int stepId = service.testStepsAdd(authData, step, "Y");
  System.out.format("Step %d was added to the test %d%n", stepId, testId);
}

Sample Request XML

POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: text/xml; charset=utf-8
Content-Length: 850 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/TestSteps_Add"
 

<?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_Add xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>8162</DeptId>
        <ProjId>11873</ProjId>
        <UserId>24661</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <TestStep>
        <TestId>0</TestId>
        <TestStepId>10</TestStepId>
        <Seq>4</Seq>
        <Step>Select Tools from the application's main menu.</Step>
        <DateCreated>0001-01-01T00:00:00</DateCreated>
        <DateUpdated>0001-01-01T00:00:00</DateUpdated>
        <CreateUserId>0</CreateUserId>
        <UpdateUserId>0</UpdateUserId>
        <NbrFiles>0</NbrFiles>
        <ScriptSourceId>0</ScriptSourceId>
      </TestStep>
      <SendEmailAlert>Y</SendEmailAlert>
    </TestSteps_Add>
  </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: 858 {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_Add xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>8162</DeptId>
        <ProjId>11873</ProjId>
        <UserId>24661</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <TestStep>
        <TestId>0</TestId>
        <TestStepId>10</TestStepId>
        <Seq>4</Seq>
        <Step>Select Tools from the application's main menu.</Step>
        <DateCreated>0001-01-01T00:00:00</DateCreated>
        <DateUpdated>0001-01-01T00:00:00</DateUpdated>
        <CreateUserId>0</CreateUserId>
        <UpdateUserId>0</UpdateUserId>
        <NbrFiles>0</NbrFiles>
        <ScriptSourceId>0</ScriptSourceId>
      </TestStep>
      <SendEmailAlert>Y</SendEmailAlert>
    </TestSteps_Add>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 374 {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_AddResponse xmlns="http://www.pragmaticsw.com/">
      <TestSteps_AddResult>10</TestSteps_AddResult>
    </TestSteps_AddResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 384 {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_AddResponse xmlns="http://www.pragmaticsw.com/">
      <TestSteps_AddResult>10</TestSteps_AddResult>
    </TestSteps_AddResponse>
  </soap12:Body>
</soap12:Envelope>

See Also

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

Highlight search results