LambdaTest HyperExecute

Executing LocalStack tests on LambdaTest’s HyperExecute

HyperExecute is a test orchestration platform designed to optimize the execution of automated tests in the cloud. It supports a wide range of testing frameworks and integrates seamlessly with CI/CD pipelines, such as GitHub Actions. You can use HyperExecute to run your LocalStack tests on your local machine or in the CI pipeline using a single configuration file.

Getting started

To get started with HyperExecute, you need to fulfill the following prerequisites:

Configuring the HyperExecute environment

Create a new file named he.yml in the root directory of your project and add the following content:

version: "0.1"
runson: linux
autosplit: true
parallelism: 2
concurrency: 2
scenarioCommandStatusOnly: true
  language: python
  version: 3.10
  - pip install localstack awscli awscli-local
  - localstack start -d
  - localstack wait -t 60
  - awslocal s3 mb s3://test-bucket
  - awslocal sqs create-queue --queue-name test-queue
  - awslocal sns create-topic --name test-topic

The above minimal configuration file starts LocalStack and creates an S3 bucket, SQS queue, and SNS topic.

Enabling test execution on HyperExecute

To enable test execution on HyperExecute, you need to add the following content to your GitHub Actions workflow file:

version: "0.1"
runson: linux
  - bin/
type: raw
mode: dynamic
command: pytest --co -q tests | sed '$d'
testRunnerCommand: pytest $test
  platform: git
  ref: main
  accessToken: ${{ .secrets.PAT }}

Before running the tests, add your Personal Access Token (PAT) to your HyperExecute Portal as a secret. In this minimal configuration, you will set up our Serverless image resizer application and run the tests using pytest. The bin/ script is responsible for deploying the application to LocalStack. HyperExecute will automatically detect the tests and run them in parallel.

Running the tests locally

You can run the tests locally using the following command:

$ hyperexecute --user '<user-name>' --key '<HE-key>' --config he.yaml

Swap <user-name> and <HE-key> with your HyperExecute username and access key. You can find your access key in the HyperExecute Portal.

Running the tests in the CI pipeline

In this example, we will use GitHub Actions to run the tests in the CI pipeline. To do so, you need to add the following content to your GitHub Actions workflow file in .github/workflows/main.yml:

name: Running tests on HyperExecute

      - main
      - main

    runs-on: ubuntu-latest
      - uses: actions/checkout@v4
      - run: |
            chmod +x hyperexecute
            ./hyperexecute \
                --user {{ secrets.username }} \
                --key ${{ secrets.HE }} \
                --config he.yaml            

Add your username and access key to your GitHub repository secrets. You can find your access key in the HyperExecute Portal. If you are using the LocalStack Pro image, you need to add your LocalStack Auth Token to your GitHub repository secrets.

Last modified May 17, 2024: Add callout shortcode (#1260) (52d305d4e)