Skip to content

Docker images for running tests against Hypermedia APIs

License

Notifications You must be signed in to change notification settings

hypermedia-app/hypertest-docker

Repository files navigation

hydrofoil-docker

Docker images for running tests against Hypermedia APIs

hydrofoil/hydra-analyser

Wraps hydra-validator-analyse which runs static analysis against hydra-powered APIs.

Usage

This docker can be simply used directly by passing the APIs entrypoint URL:

docker run -it --rm --network host hydrofoil/hydra-analyser http://localhost:12345/

The entrypoint URL can also be passed in as an environment variable, for example in a docker-compose.yml file

version: "3"

services:
  analyzer:
    image: "hydrofoil/hydra-analyser"
    network_mode: "host"
    environment:
      ENTRYPOINT_URL: "http://localhost:12345/"

Note the use of --network host and network_mode: "host" in both examples to have the container access an app running locally. Naturally, that won't be needed if analysing a remote, publicly available service.

hydrofoil/hypertest

Compiles and runs hypertest test scenarios.

Usage

The easiest way is to use docker-compose to mount a directory containing the test scenarios as /tests in the container.

version: "3"

services:
  e2e-tests:
    image: "hydrofoil/hypertest"
    network_mode: "host"
    environment:
      BASE_URI: "http://localhost:12345/"
    volumes:
      - ./tests:/tests

The base URI can also be changed from the run command

docker-compose run e2e-tests --baseUri http://dev-env.my.app/

Filtering tests to run

Tests can be filtered by a regular expression which is matched against the relative path to test files within the tests directory. For example, running from the above docker-compose.yml:

docker-compose run e2e-tests --grep ^ProductsCollectionEndpoint/PostRequest_

Compile scenarios in-place

By default the tests will be compiled in a temporary path. An optional flag can be set to have the test JSON files generated adjacent to the input files.

docker-compose run e2e-tests --compileInPlace