Skip to main content

Execute k6 Tests on HyperExecute

k6 is an open-source tool designed to make load testing easy and accessible for developers and QA engineers. It's specifically built for testing the performance of APIs, microservices, and websites.

HyperExecute is an AI-powered Test Orchestration Cloud Platform that empowers you to run end-to-end tests quickly and efficiently. It provides Just-in-Time (JIT) testing infrastructure with fast execution speeds, smart orchestration, and detailed logs.

This guide details how to execute your k6 tests on HyperExecute using YAML 0.1

Prerequisites

To run the Tests on HyperExecute from your Local System, you are required:

Step 1: Configure Your Test Suite

You can use your own project to configure and test it. For demo purposes, we are using the sample repository.

Sample repo

Download or Clone the code sample for the k6 from the LambdaTest GitHub repository to run the tests on the HyperExecute.

Image View on GitHub

Step 2: Setup the CLI in your Test Suite

After cloning / downloading the sample repo, you need to setup the CLI and the environment variables.

Download the HyperExecute CLI

The CLI is used for triggering the tests on HyperExecute. It is recommend to download the CLI binary on the host system and keep it in the root directory of the suite to perform the tests on HyperExecute.

You can download the CLI for your desired platform from the below mentioned links:

PlatformHyperExecute CLI
Windowshttps://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe
MacOShttps://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute
Linuxhttps://downloads.lambdatest.com/hyperexecute/linux/hyperexecute

Setup Environment Variable

Now, you need to export your environment variables LT_USERNAME and LT_ACCESS_KEY that are available in the LambdaTest Profile page.

Run the below mentioned commands in your terminal to setup the CLI and the environment variables.

export LT_USERNAME="undefined"
export LT_ACCESS_KEY="undefined"

Step 3: Configure YAML in your Test Suite

You will have to add these flags mandatorily in your YAML file to execute the k6 tests:

  • runtime flag to download and install the k6 of that respective version.
runtime:
addons:
- name: k6
version: "v0.52.0"
  • env flag is used to install certain dependencies to run your test cases
env: 
K6_BROWSER_ENABLED: true #Indicates whether browser emulation is enabled for the k6 test.
K6_BROWSER_HEADLESS: false #Determines if the browser should run in headless mode
HE_CONTEXT_K6_SETUP_DEFAULT_BROWSER_PATH: true
hyperexecute.yaml
loading...

Step 4: Execute your Test Suite

NOTE : In case of MacOS, if you get a permission denied warning while executing CLI, simply run chmod u+x ./hyperexecute to allow permission. In case you get a security popup, allow it from your System PreferencesSecurity & PrivacyGeneral tab.

Run the below command in your terminal at the root folder of the project:

./hyperexecute --config RELATIVE_PATH_OF_YOUR_YAML_FILE

OR use this command if you have not exported your username and access key in the step 2.

./hyperexecute --user undefined --key undefined --config RELATIVE_PATH_OF_YOUR_YAML_FILE 

Step 5: Monitor the Test Execution

Visit the HyperExecute Dashboard and check your Job status.

Image

Test across 3000+ combinations of browsers, real devices & OS.

Book Demo

Help and Support

Related Articles