Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.
/ gulp-template Public archive

gulpjs based template to manage more complex test cases

Notifications You must be signed in to change notification settings

stormforger/gulp-template

Repository files navigation

⚠️ DEPRECATED ⚠️ - Use our forge CLI instead!

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.


GitHub Actions Badge

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.

Structure

This is the basic directory structure:

  • cases contains test cases
  • components contains helpers and modules/components that are independent of a specific test case which are meant to be re-used and shared between test cases
  • data 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 in dist 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.

Getting Started

  1. Clone or download this repository.
  2. Using Docker
    1. Make sure you have Docker Compose installed, e.g. via brew install docker-compose
    2. Run docker-compose build
    3. Install node.js dependencies: docker-compose run --rm npm install
  3. Without docker
    1. Make sure you have Node.js installed e.g. via homebrew on macOS: brew install node.js
    2. Install required Node.js dependencies via npm install
    3. Install forge, our command line tool: brew install stormforger/forge/forge

Now you can start working on your test cases!

Usage (Local)

You can also use this repository with Docker Compose (see below).

Build

To build your test cases, run

npm run build

To run a specific case, run

npm run build acme-shop

Validate & Upload Test Cases

If you have not used our CLI tool before, you have to login once (note that this works differently with Docker Compose):

forge login you@domain.com

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.

Usage (Docker Compose)

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 foo@example.com.

If not, you need to get a JWT token using

docker-compose run --rm forge login foo@example.com --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

Validate & Upload Test Cases

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

About

gulpjs based template to manage more complex test cases

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published