Create a test

Description

Creates a test.

URL

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

Remarks

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

HTTP method

POST: Creates the design test.

Request

Headers:

One of the following:

  • Content-Type: application/xml

  • Content-Type: application/json

Cookies:

Version Cookie
2020 or later

LWSSO_COOKIE_KEY={LwssoCookie};

Earlier than 2020

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

Request body:

An XML or JSON describing the test. For fields in the request, see Test entity XML.

Request example:

Copy code
JSON example
{
    "Name": "dw11",
    "TestFolderPath": "Subject\\test",
    "Content": {
      "WorkloadType": {
        "Type": "basic",
        "SubType": "by test",
        "VusersDistributionMode": "by number"
      },
      "LGDistribution": {
        "Type": "manual",        "Amount": 1
      },
      "Groups": [
        {
          "Name": "simpleflow",
          "Vusers": 11,
          "Script": {
            "ID": 175,
            "ProtocolType": "DevWeb"
          },
          "Hosts": [
            {
              "Name": "LG1",
              "Type": "automatch"
            }
          ],
          "RTS": {
            "Pacing": {
              "NumberOfIterations": 1,
              "StartNewIteration": {                "Type":"fixed delay",
                "DelayOfSeconds": 5
              }
            },
            "ThinkTime": "",
            "Log": ""
          }
        }
      ],
      "Diagnostics": {
        "Enabled": false,
        "VusersPercentage": -1,
        "EnableWebPage": false,
        "J2EEDotNet": {
          "Enable": false,
          "IsMediatorOFW": false,
          "MonitorServerRequests": false
        }
      },
      "Scheduler": {
        "Actions": [
            {
              "Initialize": {                "Type": "simultaneously",                "Vusers": 1,
                "TimeInterval": {
                  "Seconds": 1,
                  "Minutes": 0,
                  "Hours": 0
                },
                "WaitAfterInit": {
                  "Seconds": 0,
                  "Minutes": 0,
                  "Hours": 0
                }
              }
            },
            {
              "StartVusers": {                "Type":"simultaneously"
              }
            },
            {
              "Duration": {                "Type":"run for",                "TimeInterval": {
                  "Seconds": 0,
                  "Minutes": 1,
                  "Hours": 0
                }
              }
            },
            {
              "StopVusers": {
              "Type":"simultaneously"
              }
            }
          ]
      }
    }
}

Response

Headers:

One of:

  • Accept: application/xml

  • Accept: application/json

Cookies:

None

HTML return code:

One of the HTTP return codes

HTML body:

The data on the new entity. See Test creation XML.

Response example:

Copy code
<Test xmlns="http://www.hp.com/PC/REST/API">
    <ID>452</ID>
    <Name>dw11</Name>
    <CreatedBy>rnd_qa</CreatedBy>
    <LastModified>3/18/2024 1:38:27 AM</LastModified>
    <TestFolderPath>Subject\Oana</TestFolderPath>
    <Content>
        <WorkloadType>
            <Type>basic</Type>
            <SubType>by test</SubType>
            <VusersDistributionMode>by number</VusersDistributionMode>
        </WorkloadType>
        <LGDistribution>
            <Type>manual</Type>
        </LGDistribution>
        <MonitorProfiles />
        <Groups>
            <Group>
                <Name>simpleflow</Name>
                <Vusers>11</Vusers>
                <Script>
                    <ID>449</ID>
                    <ProtocolType>DevWeb</ProtocolType>
                </Script>
                <Hosts>
                    <Host>
                        <Name>LG1</Name>
                        <Type>automatch</Type>
                    </Host>
                </Hosts>
                <RTS>
                    <Pacing>
                        <NumberOfIterations>1</NumberOfIterations>
                        <StartNewIteration Type="fixed delay">
                            <DelayOfSeconds>5</DelayOfSeconds>
                        </StartNewIteration>
                    </Pacing>
                    <ThinkTime Type="replay" />
                    <Log Type="disable" />
                </RTS>
            </Group>
        </Groups>
        <Scheduler>
            <Actions>
                <Action>
                    <Initialize Type="gradually">
                        <TimeInterval>
                            <Seconds>1</Seconds>
                        </TimeInterval>
                        <Vusers>1</Vusers>
                        <WaitAfterInit />
                    </Initialize>
                </Action>
                <Action>
                    <StartVusers Type="simultaneously" />
                </Action>
                <Action>
                    <Duration Type="run for">
                        <TimeInterval>
                            <Minutes>1</Minutes>
                        </TimeInterval>
                    </Duration>
                </Action>
                <Action>
                    <StopVusers Type="gradually">
                        <Ramp>
                            <Vusers>1</Vusers>
                            <TimeInterval>
                                <Seconds>1</Seconds>
                            </TimeInterval>
                        </Ramp>
                    </StopVusers>
                </Action>
            </Actions>
        </Scheduler>
        <Diagnostics>
            <Enabled>false</Enabled>
            <VusersPercentage>-1</VusersPercentage>
            <EnableWebPage>false</EnableWebPage>
            <J2EEDotNet>
                <Enabled>false</Enabled>
                <Probes />
                <IsMediatorOFW>false</IsMediatorOFW>
                <MonitorServerRequests>false</MonitorServerRequests>
            </J2EEDotNet>
        </Diagnostics>
        <GlobalCommandLine />
        <GlobalRTS />
        <MonitorsOFW />
        <IsRuntimeCollate>true</IsRuntimeCollate>
    </Content>
</Test>

See also: