Join Wintertainment 2021 to share your stories, have fun, earn community badges, and more!

TestRuns_Add Operation

Applies to QAComplete 12.94 SaaS, last modified on December 06, 2021

Creates a new record in the run history of the specified test or test set.

Use the ProjId value in the AuthenticationData parameter to specify the project to create the test run in it.

When you add a test run, QAComplete looks for the specified test or test set and creates a TestRunItem object for the test or for each test in the set. Also, it creates a TestRunResult object for each step in the test.

Requirements

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

Parameters

The operation uses the following parameters:

AuthenticationData  :  AuthenticationData, required

An AuthenticationData object containing the login information and the project ID to create the test run in.

TestRun  :  TestRun, required

A TestRun object that contains information about the test run that you want to add to the project.

SendEmailAlert  :  string, required

Y means send an email alert to the subscribed users after adding the test run.

Any other value (for example, N or empty string) means do not send email alerts.

Result

An integer ID of the created test run.

Remarks

In the new TestRun object, you must specify either the TestId property or the TestSetId property. They refer to the test or test set whose run will be represented by the object.

Also, you can specify TestConfigId and ReleaseId to associate the test run with the test configuration and release, iteration, or build. In addition, you can specify HostId to assign the test run to the needed test host.

You do not have to specify other properties since QAComplete sets them automatically:

  • StatusCode of the TestRun and child TestRunItem and TestRunResults objects are set to the Awaiting Run.

  • ProjId, RunByUserId, RunByUserName are set to the corresponding values of the AuthenticationData object.

  • NbrTests, IsSequential, and ExecutionType are set to the corresponding values of the specified test or test set.

The TestRun object has matching Id and Name properties, for example, TestSetId and TestSetName. To set them, specify the value only for the Id property. The corresponding Name property will be set automatically.

Example

Sample Code

C#

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

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;

// Preparing the TestRun object
TestRun testRun = new TestRun();
testRun.TestId = 2112;
testRun.TestConfigId = 24;
testRun.ReleaseId = 14;
testRun.HostId = 167;

// Adding the test run
int Id = service.TestRuns_Add(authData, testRun, "N");
Console.WriteLine("ID of the added test run is: {0}", Id);

Java

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

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 TestRun object
TestRun testRun = new TestRun();
testRun.setTestId(2112);
testRun.setTestConfigId(24);
testRun.setReleaseId(14);
testRun.setHostId(167);

// Adding the test run
int Id = service.testRunsAdd(authData, testRun, "N");
System.out.format("ID of the added test run: %d%n", Id);

Sample Request XML

POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: text/xml; charset=utf-8
Content-Length: 680 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/TestRuns_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>
    <TestRuns_Add xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>7154</DeptId>
        <ProjId>1032</ProjId>
        <UserId>25315</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <TestRun>
        <TestSetId>0</TestSetId>
        <TestConfigId>24</TestConfigId>
        <ReleaseId>14</ReleaseId>
        <ReleaseName>Release 1.0</ReleaseName>
        <TestId>2112</TestId>
        <HostId>167</HostId>
      </TestRun>
      <SendEmailAlert>N</SendEmailAlert>
    </TestRuns_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: 688 {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>
    <TestRuns_Add xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>7154</DeptId>
        <ProjId>1032</ProjId>
        <UserId>25315</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <TestRun>
        <TestSetId>0</TestSetId>
        <TestConfigId>24</TestConfigId>
        <ReleaseId>14</ReleaseId>
        <ReleaseName>Release 1.0</ReleaseName>
        <TestId>2112</TestId>
        <HostId>167</HostId>
      </TestRun>
      <SendEmailAlert>N</SendEmailAlert>
    </TestRuns_Add>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 371 {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>
    <TestRuns_AddResponse xmlns="http://www.pragmaticsw.com/">
      <TestRuns_AddResult>358</TestRuns_AddResult>
    </TestRuns_AddResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

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

See Also

TestRuns_Load
TestRuns_LoadByCriteria
TestRuns_Update
Test Management Operations
Test Run Operations
SOAP API Reference

Highlight search results