Open topic with navigation

# testInstances (Create new instance in test set)

Available in versions: 12.56 and later

## Description

Adds a test instance to a test set based on the specified test.

## URL

    /LoadTest/rest/domains/{domainName}/projects/{projectName}/testInstances

## Remarks

The data can be passed as XML containing the equivalent data.

## HTTP Method

POST: Creates the test instance in the test set.

## Request

Headers:

Content-Type: application/xml

Cookies:

Version 2020 (or later) | LWSSO_COOKIE_KEY={LwssoCookie};
Versions earlier than 2020 | LWSSO_COOKIE_KEY={LwssoCookie};QCSession={QCSessionCookie};

Request Body:

An XML containing the test ID and the ID of test set in which to create the test instance.

Request Example

    POST http://<LRE_Server>/LoadTest/rest/domains/TEST_DOMAIN/projects/TEST_PROJECT/testInstances

    Content-Type: application/xml
    Cookie:
    LWSSO_COOKIE_KEY={LwssoCookie};

    <TestInstance xmlns="http://www.hp.com/PC/REST/API">
     <TestID>6</TestID>
     <TestSetID>1</TestSetID>
    </TestInstance>

## Response

Headers:

One of:

- Content-Type: application/xml
- Content-Type: application/json

Cookies:

None

HTML Return Code:

One of the HTTP Return Codes

HTML Body:

The test ID, the test set ID, and the ID of the new test instance.

Example

    <TestInstance xmlns="http://www.hp.com/PC/REST/API">
        <TestID>6</TestID>
        <TestSetID>1</TestSetID>
        <TestInstanceID>1</TestInstanceID>
    </TestInstance>

## See Also

testInstances (Get all test instances for TestID)