The gulp-template
approach to strucutre more complex StormForger test cases is deprecated. We recommend everyone to use the ES module bundling support of our command line tool.
You can find some examples in the CLI repository.
Using the build-in support for ES modules (import
/export
) in newer CLI versions is much easier to use, requires no setup or no additional dependency other than the CLI binary itself and is also much faster. Using --define
with the CLI also enables easier modification of the test case at build-time.
This repository contains test case definitions, data and tooling to manage one or more complex StormForger test cases.
It uses gulp to process configuration, scenarios and other input files to generate a full-featured StormForger test case.
This is the basic directory structure:
cases
contains test casescomponents
contains helpers and modules/components that are independent of a specific test case which are meant to be re-used and shared between test casesdata
contains test data (data sources)dist
will contain the compiled output ready to be pushed to StormForger. To make sure you keep track on all changes, we recommend to check in generated files indist
into git as well.
Each directory in cases
mirrors one test case at StormForger. Within cases
there is setup.js
which configures the test case in general. cases/scenarios/
contains one more more StormForger sessions. These scenarios can be HAR recordings for example.
- Clone or download this repository.
- Using Docker
- Make sure you have Docker Compose installed, e.g. via
brew install docker-compose
- Run
docker-compose build
- Install node.js dependencies:
docker-compose run --rm npm install
- Make sure you have Docker Compose installed, e.g. via
- Without docker
- Make sure you have Node.js installed e.g. via homebrew on macOS:
brew install node.js
- Install required Node.js dependencies via
npm install
- Install
forge
, our command line tool:brew install stormforger/forge/forge
- Make sure you have Node.js installed e.g. via homebrew on macOS:
Now you can start working on your test cases!
You can also use this repository with Docker Compose (see below).
To build your test cases, run
npm run build
To run a specific case, run
npm run build acme-shop
If you have not used our CLI tool before, you have to login once (note that this works differently with Docker Compose):
forge login [email protected]
You can then use our command line tool to validate and update your test cases automatically:
forge test-case validate acme-inc dist/acme-shop.js
forge test-case update acme-inc/shop dist/acme-shop.js
You can also use the forge
CLI to integrate into your CI system by automatically updating your test cases on merges to master e.g.
To use forge
(our command line client), you need to have STORMFORGER_JWT
set in .env
(see .env.example
for details).
docker-compose run --rm forge ping
You should see a message like PONG! Authenticated as [email protected]
.
If not, you need to get a JWT token using
docker-compose run --rm forge login [email protected] --no-save
Copy the JWT token and place it in .env
:
STORMFORGER_JWT=...
To update any locally cached docker image, run (maybe add --no-cache
)
docker-compose pull
In general, you can simply replace npm
with docker-compose run --rm npm
and forge
with docker-compose run --rm forge
and follow the usage description from above.
Examples:
docker-compose run --rm npm run build
docker-compose run --rm forge test-case ls acme-inc