# Test Execution
What You'll Learn
How you can use Gondola CLI to execute tests
# Basic Usage
- Run all the tests from current folder with common parameters:
- steps: prints detailed list steps in the console
- reporter: selects the report generator to be used
Note: Make sure the command npm run compile
has been executed from root project folder before you execute tests
gondola run --steps --reporter mochawesome
The gondola command may not have been added to your %Path% on Windows or $Path on Linux/OSx. In that case you may have to run
./node_modules/.bin/gondola run --steps --reporter mochawesome
Please modify it for the other examples like so:
./node_modules/.bin/gondola "your command line arguments here"
- Run a single test
gondola run /path/to/test.js
TIP
After you've run the command npm run compile
the compiled test files (e.g test.js
) will be located in a folder named built
in the project root.
Note
The number of concurrent tests you can run is the based on the number of agents you've purchased.
# Filter
- Run tests with "Basic" in their name
gondola run --grep "Basic"
- Run tests with the tag "@smoke_tests"
gondola run --grep "@smoke_tests"
In this example, test case "Basic 1" will be executed:
# Debug & Log
- Run the tests in debug mode
gondola run --debug --reporter mochawesome
- Print all of the logs when running the tests
gondola run --verbose --reporter mochawesome
# Custom Configurations
- Run the tests with a custom configuration file:
gondola run -c my_config_file.json
gondola run --config path/to/my_config_file.json
Note
If you put your gondola.json
file outside of the project's root directory, you will get the error screenshot cannot be displayed on the HTML report
, when running test in parallel mode. Therefore, it's recommend that you only place your configuration files (gondola.json, gondola.android.json, etc) in the project root.
- Override parts of
gondola.json
:
gondola run --override '{ "helpers": {"WebDriver": {"browser": "chrome"}}}'
# Run Multiple Browsers Concurrently
To execute the same tests using multiple browsers:
# Configuration
Add multiple
to gondola.json
as below:
{
...
"multiple": {
"regression": {
"browsers": [
"chrome",
"firefox",
"internet explorer"
]
},
"smoke": {
"grep": "@smoke_test",
"browsers": [
"chrome",
"firefox"
]
},
}
}
In this example, we've defined 2 test suites:
regression
will run all of the tests in Chrome, Firefox and Internet Explorer
smoke
will run the tests tagged with @smoke_test in Chrome and Firefox
# Execution
Run the test suites:
gondola run-multiple regression
gondola run-multiple smoke
Or if you'd like to run them in specific browsers:
gondola run-multiple regression:chrome
gondola run-multiple smoke:chrome regression:firefox
# Automatic Test Distribution
# Configuration
Specify the chunks
option under the multiple
section of gondola.json
You may need to add a multiple
section to gondola.json
if it's not already there:
{
...
"multiple": {
"regression": {
"chunks": 2,
"browsers": [
"chrome",
"firefox",
"internet explorer"
]
}
}
}
Then execute the tests using run-multiple
:
gondola run-multiple regression
# How It Works
When run-multiple
is enabled, Gondola collects all test modules and executes them in parallel in the specified number of chunks. By setting "chunks": 2
, we tell the runner to run all test modules in 2
suites in parallel.
Multiple browsers are supported. Passing more than one browser will multiply the number of suites by the number of browsers passed.
Let's say we have 11 test modules. They will be divided into 2 suites. The first suite will contain 6 test modules and the second one will contain 5. Each suite will be run in 3 browsers, so there will be 6 parallel runs.