Script Builder
Loadium Script Builder is a feature that aims to ease and quicken your load test preparation in terms of scripting.
Getting Started
There are 2 ways to utilize from Script Builder:
You can go to Create Page and choose Script Builder to start creating a test.

Creating a Script
Import
Loadium supports four different file types for importing into Script Builder.
Supported file types for import:
- Postman Collection – Exported collection of API requests from Postman. 
- HTTP Archive (HAR) – Captured network traffic in HAR format. 
- Swagger (OpenAPI) – API definitions in Swagger/OpenAPI specification. 
- Loadium Recorder File – Files recorded using the Loadium Chrome extension. 

Postman
By uploading your Postman collection to the script generator, you can easily organize it and make it ready for load testing. You can upload multiple collections at once.


Here is a preview of the script editor screen after the uploading is completed.

HTTP Archive (HAR)
Similar to Postman, you can easily import your files with the ".har" extension into the script generator.


Swagger
Loadium allows you to import your Swagger by uploading your Swagger file or using your Swagger URL.



Loadium Recorder (Google Chrome Extension)
Allows you to record HTTP requests, URLs, their parameters, and headers while you are browsing the web.
Installing the Extension
You can find the page for installing the extension to Google Chrome here.
After installing the extension, remember to pin it from the extension manager.
                                                   
Now you can easily access to Record&Play.
A quick tour of the extension’s interface.

You can find the explanation below for each numbered button:
- These buttons (start button and the big orange button) will start the recording session, as you browse, it will add requests to the Collections section. Once the recording is started, you will notice that its icon has changed.   
- If you want to clear the recording, you can use this button to wipe the collections you previously recorded. 
- You can download the recording by using this button, as .json file. 
- Pressing this button will take you to settings of recording. - These settings allows you to filter your recordings. You can define a regex pattern in order to capture specific URL’s. For example entering pattern as “https://*.youtube.com/*” will record URL’s that contains “youtube.com” in it. Furthermore, you can choose to record only the top level requests or additional sub-level requests. 
- This button will create a new set of collection next to your previous collection, which the new recordings will be added to this new collection. 
- This button will take you to the Login Page, if you’re logged in you will see your email address here. 
- If you’re logged in, clicking this button will take you to Loadium Record&Play Page, then you can start editing your recorded requests, or directly save&run your test. 
Editing Script
You can start editing your script after you've followed one of the processes:
- Pressing "Create" button, 
- Importing via Postman, HAR file, Swagger, or Loadium Recorder.. 

Make sure to save your script after making major changes to avoid losing any progress.
Collections
Collections allow you to separate the script into smaller pieces, making it easier to work with. Similar to Thread Groups in JMeter, you can add multiple collections to organize different parts of your test scenario independently. You can create collections by clicking "+ New" button.

You can add multiple collections if you want. For each collection, you can:

- Add a new request which then you can configure its details. 

- Add sleep which adds a delay before the next request. You can enter the delay amount (in milliseconds) as you desire. 

- Edit the label of your collection. 
- Duplicate the collection. 
- Delete the collection if you would like to. 
For each request in the collection, you can:

- Edit the request 
- Duplicate the request 
- Delete the request from collection 
You can also change the position of requests by gripping them, to change their order or group them in a collection.
Requests
Method Type
You can set request types as GET, POST, PUT, PATCH, DELETE, and OPTIONS.
Query Params
You can add query parameters to your request as shown in the picture.

Body
Depending on the method type, you can manage its body to send data with the request.

Headers

You can add a new header or delete the existing ones.
- To remove a header, use the Delete (trash can) icon located at the end of the corresponding row. 
- To add a new header, click the "+" button located at the top right, and specify the Key and Value fields. 
- To bulk edit request headers, click "Bulk Edit" button at the top right corner. 

You can create variables that allows you to capture a specific data from a request’s response and store it for using later.
There are 3 ways of expression to capture the data to store it in a variable:
- JSON Path 
- Regex 
- CSS Selector 

For each type there are areas to be filled, Variable Name and Expression (Attribute for CSS selector). The referred data will be stored in the variable.
For CSS Selector, there are 2 additional areas that are related to capturing the data.
- The referenced CSS element might have multiple values, attribute is for specifying to which value to restore. Leaving it empty will capture the text value of the element. 
- Match number is for choosing one outcome if there are more than one reference. Value “0” is used for random outcome. 
You can access the created variable’s value with the expression ${variableName}.
You can make various type of assertions that uses response data to check conditions:

- HTTP Status Code assertion, allows you to assert the value of the response code. 
- Body assertion, allows you to assert the body of a response. 
- Headers assertion, allows you to assert the header of a response 
- JSON Path Value assertion, allows you to capture a value using a json path expression, then compare it to expected result 
- JSON Path Assertion, asserts that the given json path expression contains value, is not null. 
After Editing
At the bottom of the page, you will see 2 buttons.

- Clicking either "Save Test" or "Run Test" will redirect you to the Main Settings tab on the New Test page, with your .jmx file uploaded and ready to run. 

- You can also configure your test settings before saving your test by clicking Test Settings tab. 

- You can also download the file as JMX or JSON (Loadium Recorder) file. 

Global Variables
You can define global variables to be used within requests when necessary. Utilizing this will make it easier when you need to constantly change some values within requests (for example, changing target URL from test environment to production environment).

Input Fields
- Variable: Name of the variable to be referenced for usage. 
- Value: Value stored in the variable 
- Description: Entering some self-explanatory notes about the created variable 
CSV Upload
Similar to JMeter, Script Builder supports CSV file upload so you can use dynamic data in your tests by referencing predefined values from your dataset.

Input Fields
- Variable Names: Name of the variables to be referenced from CSV file (make sure to split your variable names by using comma). 
- Delimeter: The separator character used to split a dataset in a csv file. 
- Ignore first line: Toggle this option if you have header line in your csv file. 
- Recycle on End of File: Reuses the CSV data from the beginning after reaching the end. 
Last updated
Was this helpful?