Return, delete, or update a test by test ID

Description

Returns, deletes, or updates a test design by the specified test ID.

URL

Copy code
/LoadTest/rest/domains/{domainName}/projects/{projectName}/tests/{ID}

Remarks

When updating the test data, the request body contains only the data to be changed. The request body is a subset of Test entity XML.

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

HTTP method

  • GET: Returns the design test.

  • PUT: Updates the design test.

  • DELETE: Deletes the test.

Request

Headers:

Content-Type: application/xml

Cookies:

Version Cookie
2020 or later

LWSSO_COOKIE_KEY={LwssoCookie};

Earlier than 2020

LWSSO_COOKIE_KEY={LwssoCookie};QCSession={QCSessionCookie};

Request body:

  • GET, DELETE: No request body.

  • PUT: An XML describing the data to be updated in the test. In addition to the updated element, the following elements must always appear: <WorkloadType>, <LGDistribution>, <Groups> and <Scheduler>. See Test entity XML.

Note: Runtime settings data provided in the request overrides the data in the system. For group RTS, only several values, such as Pacing, Log, and Think time, are displayed via the REST request. All remaining runtime settings are reset to the script's default settings. For details, see Runtime settings.

Request examples:

Copy code
XML example - GET:
GET http://<LRE_Server>/LoadTest/rest/domains/TEST_DOMAIN/projects/TEST_PROJECT/tests/1
Content-Type: application/xml
Cookie: LWSSO_COOKIE_KEY={LwssoCookie};
Copy code
XML example - PUT:
PUT http://<LRE_Server>/LoadTest/rest/domains/TEST_DOMAIN/projects/TEST_PROJECT/tests/1
Content-Type: application/xml
Body:

<Content xmlns="http://www.hp.com/PC/REST/API">
<WorkloadType> 
   <Type>Basic</Type>
   <SubType>by test</SubType>
   <VusersDistributionMode>by number</VusersDistributionMode>
</WorkloadType>
<LGDistribution>
   <Type>all to each group</Type>
   <Amount>1</Amount>
</LGDistribution>
<Groups>
   <Group>
       <Name>auto_group</Name>
       <Vusers>23</Vusers>
       <Script>
           <ID>4</ID>
       </Script>
   </Group>
</Groups>
<Scheduler>
<Actions>
   <Action>
      <Initialize Type="just before vuser runs">
      <Vusers>0.0</Vusers>
      </Initialize Type>
   </Action>
   <Action>
       <StartVusers Type="gradually">
       <Ramp>
           <TimeInterval>
               <Days>0</Days>
               <Hours>0</Hours>
               <Minutes>0</Minutes>
               <Seconds>50</Seconds>
           </TimeInterval>
        </Ramp>
        <StartVusers Type>
   </Action>
   <Action>
       <Duration Type="run for">
       <TimeInterval>
           <Days>0</Days>
           <Hours>0</Hours
           <Minutes>2</Minutes>
           <Seconds>0</Seconds>
       </TimeInterval>
       </Duration>
   </Action>
   <Action>
       <StopVusers Type="simultaneously">
       </StopVusers>
   </Action>
</Actions>
</Scheduler>
</Content>

Response

Headers:

One of:

  • Accept: application/xml

  • Accept: application/json

Cookies:

None

HTML return code:

One of the HTTP return codes

HTML body:

  • DELETE and PUT: No body returned.

  • GET: Returns the data on the entity in the test entity XML or equivalent JSON string. See Test creation XML.

Response examples:

Copy code
Get Test by ID response body XML:
<Test xmlns="http://www.hp.com/PC/REST/API">
    <ID>181</ID>
    <Name>Test_123</Name>
    <CreatedBy>sa</CreatedBy>
    <LastModified>3/20/2024 11:36:58 AM</LastModified>
    <TestFolderPath>Subject\tests</TestFolderPath>
    <Content>
        <WorkloadType>
            <Type>basic</Type>
            <SubType>by test</SubType>
            <VusersDistributionMode>by number</VusersDistributionMode>
        </WorkloadType>
        <LGDistribution>
            <Type>manual</Type>
        </LGDistribution>
        <MonitorProfiles />
        <Groups>
            <Group>
                <Name>cvuser_command_line</Name>
                <Vusers>1</Vusers>
                <Script>
                    <ID>178</ID>
                    <ProtocolType>Web - HTTP/HTML</ProtocolType>
                </Script>
                <CommandLine>-tname LEONID</CommandLine>
                <Hosts>
                    <Host>
                        <Name>LG1</Name>
                        <Type>automatch</Type>
                    </Host>
                </Hosts>
                <RTS>
                    <Pacing>
                        <NumberOfIterations>1</NumberOfIterations>
                        <StartNewIteration Type="random delay">
                            <DelayAtRangeOfSeconds>2</DelayAtRangeOfSeconds>
                            <DelayAtRangeToSeconds>10</DelayAtRangeToSeconds>
                        </StartNewIteration>
                    </Pacing>
                    <ThinkTime Type="replay" />
                    <Log Type="disable" />
                </RTS>
            </Group>
        </Groups>
        <Scheduler>
            <Actions>
                <Action>
                    <Initialize Type="just before vuser runs" />
                </Action>
                <Action>
                    <StartVusers Type="simultaneously" />
                </Action>
                <Action>
                    <Duration Type="until completion" />
                </Action>
            </Actions>
        </Scheduler>
        <SLA />
        <IsRuntimeCollate>true</IsRuntimeCollate>
    </Content>
</Test>
Copy code
Get Test by ID response body JSON:
{
    "ID": 176,
    "Name": "e2e_test",
    "CreatedBy": "auto_user_t32hieduatb",
    "LastModified": "3/25/2024 11:27:04 PM",
    "TestFolderPath": "Subject\\e2e_25-03-2024-11-25-28-PM\\level2\\level3\\level4",
    "Content": {
        "WorkloadType": {
            "Type": "basic",
            "SubType": "by test",
            "VusersDistributionMode": "by number"
        },
        "LGDistribution": {
            "Type": "manual"
        },
        "MonitorProfiles": [],
        "Groups": [
            {
                "Name": "auto_group",
                "Vusers": 2.0,
                "Script": {
                    "ID": 175,
                    "ProtocolType": "Web - HTTP/HTML"
                },
                "CommandLine": null,
                "Hosts": [
                    {
                        "Name": "LG1",
                        "Type": "automatch"
                    }
                ],
                "RTS": {
                    "Pacing": {
                        "NumberOfIterations": 1,
                        "StartNewIteration": {
                            "Type": "immediately"
                        }
                    },
                    "ThinkTime": {
                        "Type": "replay"
                    },
                    "Log": {
                        "Type": "standard",
                        "LogOptions": {
                            "Type": "on error",
                            "CacheSize": 1
                        }
                    },
                    "Name": null,
                    "JavaVM": null,
                    "JMeter": null,
                    "Selenium": null
                },
                "GlobalCommandLine": null,
                "GlobalRTS": null
            }
        ],
        "Scheduler": {
            "Actions": [
                {
                    "Initialize": {
                        "Type": "just before vuser runs"
                    }
                },
                {
                    "StartVusers": {
                        "Type": "gradually",
                        "Ramp": {
                            "Vusers": 1,
                            "TimeInterval": {
                                "Seconds": 1
                            }
                        }
                    }
                },
                {
                    "Duration": {
                        "Type": "run for",
                        "TimeInterval": {
                            "Minutes": 1
                        }
                    }
                },
                {
                    "StopVusers": {
                        "Type": "simultaneously"
                    }
                }
            ]
        },
        "GlobalCommandLines": null,
        "GlobalRTSs": null,
        "MonitorsOFW": null
    }
}

See also: