Skip to content

E2E Specs

Gauge spec files are embedded below so the executable acceptance criteria are visible in the docs.

HTTP replay adapter factory tests

This specification verifies that the HTTP adapter can be created from a Cassette file using the factory method.

Creates an adapter from a cassette file and replays a GET request

  • Create an adapter from cassette file "e2e/fixtures/simple_get.json"
  • Start the adapter on port "19876"
  • Send a GET request to "http://localhost:19876/api/data"
  • Verify that the response status code is "200"
  • Verify that the response body is "hello from cassette"

Raises an error when the cassette file does not exist

  • Verify that creating an adapter from cassette file "e2e/fixtures/nonexistent.json" raises an error

Raises an error when the cassette file contains invalid JSON

  • Verify that creating an adapter from cassette file "e2e/fixtures/invalid.json" raises an error

Raises an error when record mode is used without a live responder

  • Verify that creating an adapter from cassette file "e2e/fixtures/simple_get.json" in "record" mode without a live responder raises an error

Records a cassette to the store after a request in record mode

  • Create a temporary cassette file
  • Create an adapter from the temporary cassette file in "record" mode with a live responder
  • Start the adapter on port "19876"
  • Send a GET request to "http://localhost:19876/api/data"
  • Verify that the response status code is "200"
  • Verify that the response body is "recorded response"
  • Verify that the temporary cassette file contains "1" interaction

Auto mode replays existing cassette and records missing interactions

  • Create a temporary cassette file from "e2e/fixtures/simple_get.json"
  • Create an adapter from the temporary cassette file in "auto" mode with a live responder
  • Start the adapter on port "19876"
  • Send a GET request to "http://localhost:19876/api/data"
  • Verify that the response status code is "200"
  • Verify that the response body is "hello from cassette"
  • Send a GET request to "http://localhost:19876/api/other"
  • Verify that the response status code is "200"
  • Verify that the response body is "recorded response"
  • Verify that the temporary cassette file contains "2" interactions

  • Stop the adapter if running
  • Clean up temporary cassette file if created

HTTP Replay Server

This specification verifies that the HTTP replay server returns recorded responses from a Cassette.

Returns recorded response for a matching GET request

  • Create a cassette for "GET" method on "/api/data" with request body "" and status "200" and response body "hello"
  • Create a replay broker with the cassette
  • Create an HTTP adapter with the broker
  • Start the adapter on port "19876"
  • Send a GET request to "http://localhost:19876/api/data"
  • Verify that the response status code is "200"
  • Verify that the response body is "hello"

Returns 500 for a request not in the Cassette

  • Create a cassette for "GET" method on "/api/data" with request body "" and status "200" and response body "hello"
  • Create a replay broker with the cassette
  • Create an HTTP adapter with the broker
  • Start the adapter on port "19876"
  • Send a GET request to "http://localhost:19876/api/unknown"
  • Verify that the response status code is "500"

Matches query string as part of request target

  • Create a cassette for "GET" method on "/api/data?kind=user" with request body "" and status "200" and response body "hello-query"
  • Create a replay broker with the cassette
  • Create an HTTP adapter with the broker
  • Start the adapter on port "19876"
  • Send a GET request to "http://localhost:19876/api/data?kind=user"
  • Verify that the response status code is "200"
  • Verify that the response body is "hello-query"

Returns recorded response for a matching POST request with body

  • Create a cassette for "POST" method on "/api/data" with request body "req-body" and status "201" and response body "created"
  • Create a replay broker with the cassette
  • Create an HTTP adapter with the broker
  • Start the adapter on port "19876"
  • Send a POST request to "http://localhost:19876/api/data" with body "req-body"
  • Verify that the response status code is "201"
  • Verify that the response body is "created"

Returns recorded response for a matching PUT request

  • Create a cassette for "PUT" method on "/api/items/1" with request body "update-data" and status "200" and response body "updated"
  • Create a replay broker with the cassette
  • Create an HTTP adapter with the broker
  • Start the adapter on port "19876"
  • Send a PUT request to "http://localhost:19876/api/items/1" with body "update-data"
  • Verify that the response status code is "200"
  • Verify that the response body is "updated"

Returns recorded response for a matching PATCH request

  • Create a cassette for "PATCH" method on "/api/items/1" with request body "patch-data" and status "200" and response body "patched"
  • Create a replay broker with the cassette
  • Create an HTTP adapter with the broker
  • Start the adapter on port "19876"
  • Send a PATCH request to "http://localhost:19876/api/items/1" with body "patch-data"
  • Verify that the response status code is "200"
  • Verify that the response body is "patched"

Returns recorded response for a matching DELETE request

  • Create a cassette for "DELETE" method on "/api/items/1" with request body "" and status "204" and response body ""
  • Create a replay broker with the cassette
  • Create an HTTP adapter with the broker
  • Start the adapter on port "19876"
  • Send a DELETE request to "http://localhost:19876/api/items/1"
  • Verify that the response status code is "204"

Returns recorded response for a matching HEAD request

  • Create a cassette for "HEAD" method on "/api/health" with request body "" and status "200" and response body ""
  • Create a replay broker with the cassette
  • Create an HTTP adapter with the broker
  • Start the adapter on port "19876"
  • Send a HEAD request to "http://localhost:19876/api/health"
  • Verify that the response status code is "200"

Returns recorded response for a matching OPTIONS request

  • Create a cassette for "OPTIONS" method on "/api/data" with request body "" and status "204" and response body ""
  • Create a replay broker with the cassette
  • Create an HTTP adapter with the broker
  • Start the adapter on port "19876"
  • Send an OPTIONS request to "http://localhost:19876/api/data"
  • Verify that the response status code is "204"

  • Stop the adapter if running

interposition_http_adapter Package Metadata Verification

This specification ensures that the interposition_http_adapter package is properly configured and follows industry standards for versioning.

Ensure version follows Semantic Versioning

  • Import the "interposition_http_adapter" package
  • Verify that "version" follows the Semantic Versioning format

Verify CLI version command

  • Execute the CLI command with "--version"
  • Import the "interposition_http_adapter" package
  • Verify that the output matches the version from the package