Skip to main content

Running Gwen on LambdaTest HyperExecute

The HyperExecute grid by LambdaTest can remotely execute your Gwen features across combinations of platforms, browsers, and devices at near local speeds using configurable orchestration strategies. Follow the instructions here to get your Gwen features running on HyperExecute.

Get started

Start a new Gwen project or use an existing one.

Settings file

Create a new lambdatest.conf settings file in your browsers directory as shown.

./project                       # Your project root
└── /gwen
└── /browsers
└── lambdatest.conf # LambdaTest settings file

Add the following content

gwen {
web {
capabilities {
"LT:Options" {
video = true
}
}
remote {
url = "https://${env.LT_USERNAME}:${env.LT_ACCESS_KEY}@hub.lambdatest.com/wd/hub"
}
}
}

You can enable more LambdaTest capabilities in the LT:Options block if you wish. This example just enables video.

Browser specific capabilities

If you want to configure browser specific capabilities, you can do so in the respective .conf files in your gwen/browsers directory:

./project                       # Your project root
└── /gwen
└── /browsers
├──chrome.conf
├──edge.conf
└──firefox.conf

HyperExecute YAML

Next, create a hyper-execute.yml file in the gwen directory of your project.

./project                     # Your project root
└── /gwen
└── hyper-execute.yml # HyperExecute YAML file

Add the following content to execute all your Gwen features across Chrome, Edge, and Firefox browsers on Linux using 10 parallel sessions.

version: 0.1

globalTimeout: 90
testSuiteTimeout: 90
testSuiteStep: 90

autosplit: true
parallelism: 10
concurrency: 10

runson: ${matrix.os}

pre:
- yarn install

cacheDirectories:
- node_modules

matrix:
os: [linux]
browser: ["chrome", "edge", "firefox"]

testDiscovery:
type: raw
mode: dynamic
command: find gwen/features -type f -name "*.feature"

testRunnerCommand: yarn gwen -b -c gwen/browsers/lambdatest.conf,gwen/browsers/$browser.conf $test

The testDiscovery element locates every feature file in the gwen/features directory and the matrix element automatically distributes and executes each of those in parallel across all the combinations of OS and browsers configured. Each browser and each feature file is passed to Gwen as $browser and $test respectively.

If you want to run the Gwen samples instead, replace gwen/features with gwen/samples in the testDiscovery command.

More information about the HyperExecute YAML here.

Locally or privately hosted pages and repositories

If your Gwen features will be running over locally or privately hosted web pages, you will need to include the following in your hyper-execute.yml file to open a tunnel back to your network

tunnel: true

And to download your package.json dependencies from a local or private hosted repository, you will need to additionally configure yarn to go through the LambaTest proxy in your hyper-exeucte.yml file

tunnel: true

pre:
- yarn config set proxy http://${LT_PROXY_HOST}:${LT_PROXY_PORT}
- yarn install

Package JSON script

Create a new gwen:hyperExecute script in the scripts section of the package.json file in your project to invoke the HyperExecute CLI and launch on the grid.

./project             # Your project root
└── package.json # Package json file
"scripts": {
"gwen:hyperExecute": "./hyperexecute --config gwen/hyper-execute.yml"
}

Launch

Download the HyperExecute binary for your platform to the root of your project.

./project                       # Your project root
└── hyperexecute # HyperExecute binary

Create a .hyperexecuteignore file in the root of your project.

./project                       # Your project root
└── .hyperexecuteignore # HyperExecute ignore file

Add the following content to the ignore file to prevent the binary and the Gwen output directory from being uploaded

hyperexecute
gwen/output

Set the following enviornment variables on your system to your LambdaTest username and access key:

  • LT_USERNAME
  • LT_ACCESS_KEY

Then call the gwen:hyperExecute script in your project to launch your Gwen features on the HyperExecute grid

yarn gwen:hyperExecute

Open the HyperExecute dashboard to view your executions.


See also: