Skip to main content
No Result Found
Get your setup working faster. Join our Discord for optimisation tips from elite testers. Join our DiscordJoin our Discord

Protocol load testing using k6

Run a protocol load test on BrowserStack Load Testing

Prerequisites

  • BrowserStack Username and Access key. You can find these under your account profile.
  • An existing k6 script.

Supported versions

BrowserStack runs your k6 load tests on the following engine version:

Tool Recommended version
k6 2.0.0

Run a test

You can start a new test either from the Quick Start page or the Load Tests page on the Load testing dashboard.

On the dashboard, click Create Load Test.

Screenshot of load testing dashboard showing the run a new test button highlighted

Enter a Test Name for your load test, select API Only, and click Upload scripts

Dashboard showing test name field and type of load test to run

Upload scripts

In this step, upload your k6 script.

Screenshot of load testing dashboard asking to add scripts for load testing

Once you have verified the configuration, click Configure Load to move to the next step.

You can also run load tests using the sample scripts if you want to try out the feature before uploading your own files.

Use multi-file k6 scripts from the UI

You can upload a modular k6 test suite that uses multiple .js files and dependencies.

Upload scripts
  • In the Script section of your load test configuration, choose one of the following:
    • Upload a single .js file.
    • Alternatively, you can also upload a .zip file that contains your main k6 script and any additional supporting files.
  • When you upload a .zip file:
    • Enter the main script path in the Main script field, relative to the root of the ZIP (for example, tests/main.js). The platform uses this as the k6 entry point. Screenshot of uploaded k6 scripts in the load testing UI builder
    • Keep your folder hierarchy inside the ZIP. Relative imports such as import { helper } from './utils/helper.js' continue to work because the directory structure is preserved during execution.
Validation rules
  • If you upload a ZIP and leave the Main script field empty, the test configuration shows an error and you cannot start the run until you specify an entry file.
  • If the main script you specify does not exist inside the ZIP, the test configuration shows an error that the entry file cannot be found in the uploaded archive.
  • The maximum supported ZIP size is 100 MB. If the archive exceeds this limit, the upload is rejected with a clear error message.

Use these checks to confirm the correct entry path before you run the test, so that all imports resolve successfully at runtime.

You can configure the following load parameters to customize your load test:

Run test

After you finish configuring load parameters, click RUN TEST .

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle