Integration Testing your HTTP API with Cucumber
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore Initial commit including an express server with an insecure endpoint Jun 14, 2017
Gruntfile.js Start the server on a random free port, instead of the default Jun 28, 2017
README.md Added a README Jun 28, 2017
package.json Support for asserting the content of the response Jun 28, 2017

README.md

Integration Testing your HTTP API with Cucumber

Build Status

This repository is an example application for demonstrating Cucumber testing of an HTTP API. The tag "application-to-test" shows the application with no tests at all, and all commits after this tag show adding Cucumber tests to the system.

Application

The application in question has the following endpoints:

  • Getting an Insecure resource - GET /api/insecure
  • Getting a Secure resource, which needs an access token to retrieve - GET /api/secure
  • Getting an Access Token by authenticating - GET /api/auth
  • Getting a List of resources - GET /api/list
  • Modifying a resource - POST /api/insecure
  • Resetting the system to a known state - POST /api/reset

Structure

The application itself lives in src/server. This can be run manually by executing node src/server/index.js.

The tests all live in src/acceptance. These can be executed by running grunt acceptance, which will:

  • Start the server
  • Run the tests against the server
  • Shut everything down