TestSets_Add Operation

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

Adds a new test set to your project in QAComplete and returns the ID of the added test set.

To add tests to the test set:

  • Create tests using Tests_Add, if needed.

  • Call TestSetItems_Add for each test you want to add, and use the following parameters:

    • TestSetItem.TestSetId – The test set ID.

    • TestItem.TestId – The test ID.

Requirements

The authenticating user must belong to a security group that has the Add privilege for Test Management > Test Sets.

Parameters

The operation uses the following parameters:

AuthenticationData  :  AuthenticationData, required

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

TestSet  :  TestSet, required

The TestSet object to add to Test Management.

SendEmailAlert  :  string, required

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

NewNotes  :  string, required

A note to attach to the test set.

Result

The ID of the added test set.

Remarks

The TestSet object you pass to the method must have all properties required by your instance of QAComplete specified. To learn what properties are required:

  • In QAComplete, open  > Setup > System Configuration > Screen Layouts > Test Sets > Required Fields. View the required test set properties on the Required Fields list.

  • In QAComplete, open Test Management > Test Sets > Actions > Manage Workflows. Select the desired test set status on the Status list and click Select fields for this Transition to view the list of required test set properties.

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

Example

Sample Code

This example creates a test set with two tests.

C#

string login = "[email protected]";
string password = "p@ssword";
int projID = 10372;

// Specifying properties of the test set
string title = "Regression Tests - Release 3.1.0";
string status = "New";

// Specify the IDs of the tests associated with the items
int[] testIDs = { 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;

// Prepare the TestSet object
TestSet set = new TestSet();
set.Title = title;
set.StatusCode = status;

// Add the test set
int testSetId = service.TestSets_Add(authData, set, "Y", "This test set was added from code.");
Console.WriteLine("The ID of the created test set: {0}", testSetId);

for (int i=0; i<2; i++)
{
  // Prepare the TestSetItem object
  TestSetItem item = new TestSetItem();
  item.TestSetId = testSetId;
  item.TestId = testIDs[i];

  // Add the test set item
  int testSetItemId = service.TestSetItems_Add(authData, item, "Y");
  Console.WriteLine("The test set item {0} was added to the test set {1}", testSetItemId, testSetId);
}

Java

String login = "[email protected]";
String password = "p@ssword";
int projID = 10372;

// Specify properties of the test set
String title = "Regression Tests - Release 3.1.0";
String status = "New";

// Specify the IDs of the tests associated with the items
int[] testIDs = {1, 2};

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(projID);

// Prepare the TestSet object
TestSet set = new TestSet();
set.setTitle(title);
set.setStatusCode(status);

// Add the test set
int testSetId = service.testSetsAdd(authData, set, "Y", "This test set was added from code.");
System.out.format("The ID of the created test set: %d%n", testSetId);

for (int i=0; i<2; i++)
{
  // Prepare the TestSetItem object
  TestSetItem item = new TestSetItem();
  item.setTestSetId(testSetId);
  item.setTestId(testIDs[i]);

  // Add the test set item
  int testSetItemId = service.testSetItemsAdd(authData, item, "Y");
  System.out.format("The test set item %d was added to the test set %d%n", testSetItemId, testSetId);
}

Sample Request XML

POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: text/xml; charset=utf-8
Content-Length: 1648 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/TestSets_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>
    <TestSets_Add xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>8162</DeptId>
        <ProjId>11873</ProjId>
        <UserId>24661</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <TestSet>
        <TestSetId>0</TestSetId>
        <ProjId>0</ProjId>
        <FolderId>0</FolderId>
        <CreateUserId>0</CreateUserId>
        <UpdateUserId>0</UpdateUserId>
        <OriginalId>0</OriginalId>
        <ImportId>0</ImportId>
        <OwnerUserId>0</OwnerUserId>
        <AssigneeUserId>0</AssigneeUserId>
        <Title>Regression Tests - Release 3.1.0</Title>
        <StatusCode>New</StatusCode>
        <DateCreated>0001-01-01T00:00:00</DateCreated>
        <DateUpdated>0001-01-01T00:00:00</DateUpdated>
        <EstStart>0001-01-01T00:00:00</EstStart>
        <EstFinish>0001-01-01T00:00:00</EstFinish>
        <ActStart>0001-01-01T00:00:00</ActStart>
        <ActFinish>0001-01-01T00:00:00</ActFinish>
        <NbrTests>0</NbrTests>
        <LastRunDate>0001-01-01T00:00:00</LastRunDate>
        <LastRunByUserId>0</LastRunByUserId>
        <NbrTimesRun>0</NbrTimesRun>
        <AvgRunTime>0</AvgRunTime>
        <NbrEscalations>0</NbrEscalations>
        <DateLastEscalated>0001-01-01T00:00:00</DateLastEscalated>
        <LastEscalationRuleId>0</LastEscalationRuleId>
        <NbrFilesNotSecured>0</NbrFilesNotSecured>
        <NbrFiles>0</NbrFiles>
        <NbrNotes>0</NbrNotes>
        <NbrEvents>0</NbrEvents>
        <PctComplete>0</PctComplete>
        <EstHrs>0</EstHrs>
        <ActHrs>0</ActHrs>
        <EstHrsRemaining>0</EstHrsRemaining>
      </TestSet>
      <SendEmailAlert>Y</SendEmailAlert>
      <NewNotes>This test set was added from code.</NewNotes>
    </TestSets_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: 1656 {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>
    <TestSets_Add xmlns="http://www.pragmaticsw.com/">
      <AuthenticationData>
        <AppCode>agSP</AppCode>
        <DeptId>8162</DeptId>
        <ProjId>11873</ProjId>
        <UserId>24661</UserId>
        <PassCode>p@ssword</PassCode>
      </AuthenticationData>
      <TestSet>
        <TestSetId>0</TestSetId>
        <ProjId>0</ProjId>
        <FolderId>0</FolderId>
        <CreateUserId>0</CreateUserId>
        <UpdateUserId>0</UpdateUserId>
        <OriginalId>0</OriginalId>
        <ImportId>0</ImportId>
        <OwnerUserId>0</OwnerUserId>
        <AssigneeUserId>0</AssigneeUserId>
        <Title>Regression Tests - Release 3.1.0</Title>
        <StatusCode>New</StatusCode>
        <DateCreated>0001-01-01T00:00:00</DateCreated>
        <DateUpdated>0001-01-01T00:00:00</DateUpdated>
        <EstStart>0001-01-01T00:00:00</EstStart>
        <EstFinish>0001-01-01T00:00:00</EstFinish>
        <ActStart>0001-01-01T00:00:00</ActStart>
        <ActFinish>0001-01-01T00:00:00</ActFinish>
        <NbrTests>0</NbrTests>
        <LastRunDate>0001-01-01T00:00:00</LastRunDate>
        <LastRunByUserId>0</LastRunByUserId>
        <NbrTimesRun>0</NbrTimesRun>
        <AvgRunTime>0</AvgRunTime>
        <NbrEscalations>0</NbrEscalations>
        <DateLastEscalated>0001-01-01T00:00:00</DateLastEscalated>
        <LastEscalationRuleId>0</LastEscalationRuleId>
        <NbrFilesNotSecured>0</NbrFilesNotSecured>
        <NbrFiles>0</NbrFiles>
        <NbrNotes>0</NbrNotes>
        <NbrEvents>0</NbrEvents>
        <PctComplete>0</PctComplete>
        <EstHrs>0</EstHrs>
        <ActHrs>0</ActHrs>
        <EstHrsRemaining>0</EstHrsRemaining>
      </TestSet>
      <SendEmailAlert>Y</SendEmailAlert>
      <NewNotes>This test set was added from code.</NewNotes>
    </TestSets_Add>
  </soap12:Body>
</soap12:Envelope>

Sample Response XML

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

SOAP 1.2

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

See Also

TestSets_Delete
TestSets_Load
TestSets_LoadByCriteria
TestSets_Update
Test Management Operations
Test Set Operations
SOAP API Reference

Highlight search results