Upload or retrieve scripts

Description

Uploads the following scripts to, or retrieves them from OpenText Enterprise Performance Engineering or ALM (for VuGen and JMeter scripts).

Script typeSupported in version
DevWeb (standalone) 2020 SP3 or later
Gatling 2020 SP3 or later
OpenText Functional Testing (GUI or API tests) 2020 SP3 or later
VuGen

2020 or later

Note: ALM is supported in versions 12.6x or earlier

JMeter

2020 or later

Note: ALM is supported in versions 12.6x or earlier

Kafka 2022 or later

URL

Copy code
/LoadTest/rest/domains/{domainName}/projects/{projectName}/Scripts

Remarks

None

HTTP method

  • POST: Uploads a VuGen, JMeter, DevWeb, Gatling, or OpenText Functional Testing GUI or API test script to OpenText Enterprise Performance Engineering or to ALM (for VuGen or JMeter scripts).

  • GET: Returns the script in the body of the response.

Request

Headers:

Content-Type: multipart/form-data

Cookies:

Version Cookie
2020 or later

LWSSO_COOKIE_KEY={LwssoCookie};

Earlier than 2020

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

Request body:

  • GET: No request body

  • POST: Multipart data with two entities: a zipped script and an XML or JSON describing the uploaded script.

    1. In the Body section of the API tool, add the XML or JSON as Text.

    2. Add XML or JSON to the file (see the POST example below and the field descriptions in the table).

    3. Add the zipped script to the body as a File.

    4. After uploading the script, you should receive the response.

    The fields in the POST request are listed below.

    ElementDescription
    ScriptThe top-level element.
    TestFolderPath

    This is the path of the folder on OpenText Enterprise Performance Engineering (or within Test Plan for ALM) where the script will be saved.

    OverwriteAction if script with the same pathname already exists. One of:
    • true: Overwrite existing script. (default)
    • false: Automatically rename new script.
    RuntimeOnly One of:
    • true: Upload only runtime files. (default)
    • false: Upload all files.

    KeepCheckedOut

    (Not relevant in version 2020 or later)

    Applies if project supports versioning to indicate whether the script needs to be checked in/out after an upload. Use one of:

    • true: Uploaded script will remain checked-out.
    • false: Uploaded script is checked in. (default).

    Note: If the project does not support version control, this element is meaningless and you can leave the default value ("false") or not use the KeepCheckedOut element at all. Do not send an empty element.

    IsAutosplitJMX(For JMeter scripts only) Select "true" to split a .jmx file that contains a number of JMeter groups into a separate .jmx file for each group.

Request examples:

Copy code
GET example:
GET http://<LRE_Server>/LoadTest/rest/domains/alex-qc/projects/demo_project/Scripts
Copy code
XML example - POST:
POST http://<LRE_Server>/LoadTest/rest/domains/alex-qc/projects/demo_project/Scripts
Content-Type: multipart/form-data; boundary="d8a33232-f54d-4fa6-a888-0b6b34810dfc"
Content-Length: <content length>
Expect: 100-continue 
--d8a33232-f54d-4fa6-a888-0b6b34810dfc
Content-Disposition: form-data; name=metadata

<Script xmlns="http://www.hp.com/PC/REST/API"> 
     <TestFolderPath>path to upload the script to LRE/ALM</TestFolderPath> 
     <Overwrite>true</Overwrite> 
     <RuntimeOnly>false</RuntimeOnly> 
     <KeepCheckedOut>false</KeepCheckedOut> 
 </Script>  

--d8a33232-f54d-4fa6-a888-0b6b34810dfc
Content-Disposition: form-data; filename=ScriptWithVuserLog.zip
Content-Type: application/x-zip-compressed
<Content of the compressed script>
--d8a33232-f54d-4fa6-a888-0b6b34810dfc--
Copy code
JSON example - POST:
POST http://<LRE_Server>/LoadTest/rest/domains/alex-qc/projects/demo_project/Scripts 
Content-Type: multipart/form-data; boundary="d8a33232-f54d-4fa6-a888-0b6b34810dfc"
Content-Length: <content length>
Expect: 100-continue 
--d8a33232-f54d-4fa6-a888-0b6b34810dfc
Content-Disposition: form-data; name=metadata
{
    "TestFolderPath": "Subject\\e2e",
    "Overwrite": true,
    "RuntimeOnly": false,
    "KeepCheckedOut": false
}
--d8a33232-f54d-4fa6-a888-0b6b34810dfc
Content-Disposition: form-data; filename=ScriptWithVuserLog.zip
Content-Type: application/x-zip-compressed
<Content of the compressed script>
--d8a33232-f54d-4fa6-a888-0b6b34810dfc--

Note: The value of the element boundary which marks the start and the end of the elements in HTTP multipart/form-data request is a value that can be changed based on the library being used (d8a33232-f54d-4fa6-a888-0b6b34810dfc is an example of a boundary value).

Response

Headers:

One of:

  • Accept: application/xml

  • Accept: application/json

Cookies:

None

HTML return code:

One of the HTTP return codes

HTML body:

GET: Returns the data on the entity in the response. The fields in the response are listed below.

ElementDescription
NameThe script name.
CreatedByA user name.
TestFolderPathPath of the test folder.
ContentTest description. See Test entity XML
IDThe script ID.
WorkingModeWhat files were uploaded: Runtime only files or All files
Protocol

The script protocol as defined in VuGen, JMeter, DevWeb, Gatling, or UFT One GUI or API tests.

LastModifyDateDate on which the script was last modified.
CreationDateThe script creation date.
IsScriptLockedIndicates whether script is locked (being edited by another user).

Response examples:

Copy code
XML example:
<Script xmlns="http://www.hp.com/PC/REST/API"> 
     <ID>8</ID> 
     <Name>login_logout_page</Name> 
     <CreatedBy>john</CreatedBy> 
     <TestFolderPath>Subject\testFolder01</TestFolderPath> 
     <WorkingMode>Runtime</WorkingMode> 
     <Protocol>Web - HTTP/HTML</Protocol>
     <LastModifyDate>2023-07-14T09:05:21.835448</LastModifyDate>
     <CreationDate>2023-07-14T09:05:21.159522</CreationDate>
     <IsScriptLocked>false</IsScriptLocked>
</Script>  
Copy code
JSON example:
{    "ID": 231,
     "Name": "Generate_Transactions",
     "CreatedBy": "sa",
     "TestFolderPath": "Subject\\e2e",
     "WorkingMode": "Runtime",
     "Protocol": "Web - HTTP/HTML",
     "LastModifyDate": null,
     "CreationDate": null,
     "IsScriptLocked": false,
     "SplitScriptResponse": null
}

Note: The value of the element boundary which marks the start and the end of the elements in HTTP multipart/form-data request is a value that can be changed based on the library being used (d8a33232-f54d-4fa6-a888-0b6b34810dfc is an example of a boundary value).

See also: