Updated on 2024-11-05 GMT+08:00

Importing Recorded Scripts

In performance tests, virtual users simulate real users to use the tested system. The simulation process, such as login, search, and purchase in e-commerce applications, is implemented through recorded scripts. CodeArts PerfTest supports the record tool plug-in on the Chrome browser (version 26 or later versions). In the pressure test system, you can manually perform operations to capture request content and generate .json files. The recorded scripts simulate the actual operations of users, reducing the workload of manual packet writing and facilitating the use of the CodeArts PerfTest system.

Restrictions

The CodeArts PerfTest record tool requires version 26 or later versions of Chrome.

Click in the upper right corner of the browser and choose Help > About Chrome to view the browser version.

Downloading and Installing the Chrome Recording Plug-in

  1. Download the recording plug-in for Chrome.
  2. Decompress the installation package using a decompression tool.
  3. Enter chrome://extensions/ in the address bar. The extension page is displayed.
  4. Enable the developer mode on the extension page.

    Figure 1 Enabling the developer mode

  5. Click Load unpacked and load the folder decompressed in 2.
  6. When the installation is complete, the icon of the recording tool is displayed in Extensions in the upper right corner of the browser.

    Figure 2 Recording tool

Recording Scripts

Use the CodeArts PerfTest recording tool to record scripts.

  1. Open Chrome and click the icon of the CodeArts PerfTest recording tool in the upper right corner of the browser. The recording box is displayed.
  2. Click Start Recording.
  3. On the new tab page of the browser, enter the URL to be tested. The recording tool automatically records the HTTP requests during the access operation.
  4. When the recording is complete, switch to the recording tool page and click Pause Recording.
  5. By default, the record tool displays all types of requests. You can select the request composition based on the service requirements by clicking the Filter Content check box.

    • other: others
    • script: script
    • xmlhttprequest: XML HTTP request
    • main_frame: main frame
    • stylesheet: style sheet
    • image: image
    • font: font file
    • Ping: ping test

  6. If you select a request, the content of the request is displayed on the right of the page.

    If the recorded content is not required or a new request needs to be recorded, perform the following steps to record scripts again:

    1. Click Clear Content to clear the recorded request content.
    2. Click Start Recording.
    3. Perform operations on the new tab page and record again.

  7. Click Export, select the request to be exported, and click Confirm Export. The Export Content dialog box is displayed. Click Generate .json File to save the file to the local host.

    Plug-in recording script. The body type does not support the payload format.

  8. Close the tab where the record tool is located to disable the record tool.

Importing Recorded Scripts

  1. Log in to the CodeArts PerfTest console and choose PerfTest Projects in the left navigation pane.
  2. Locate a PerfTest project to be edited and click to edit the transaction library.
  3. Import a recorded script using either of the following methods:

    Method 1: On the Transactions tab page, click Import Script. Set Script Type to Manual recording script. Select the transaction and recorded script file to be imported.

    The recorded script contains one or more packet requests and can be imported to the corresponding transaction mode.

    Method 2: On the right of the desired transaction name, click Import Recorded Script and select the script file to be uploaded.

  4. Click Import. If the scripts are imported successfully, the system displays a message indicating this.
  5. Under the transaction, you can view the packets successfully imported.

    The number of packets successfully imported is the same as the number of requests in the uploaded script file.

  6. (Optional) Click to modify the imported scripts by referring to Adding Request Information (Think Time) based on service requirements.