Challenge Overview

The goal of this challenge is to build automated test script for the provided API using NodeJS.

The unit tests will be built to run against a mock server, and in future we are replacing the mock server with the client API server, so unlike Test Suite challenges, this one will be around validating the API calls response structure not the data itself.

Challenge Requirements

API and Swagger Definition

- We have a mock server API deployed to https://bankambassador.herokuapp.com  

- You will use the mock server as the endpoint for the test suite.

- The mock API source code can be found in gitlab  https://gitlab.com/bank-ambassador/rest-api (please check forums to get access)

- We have swagger API definition under ‘swagger’ folder in the mock server api source code in gitlab. You can open the swagger definition in the API repository in http://editor.swagger.io/#/ and directly test the api we are hosting in heroku or you can deploy API in locally.

Test Suite Requirement

- Use Mocha for writing the tests, both accuracy and failure cases.

- Follow the API swagger definition to write the unit tests.

- The unit tests should not validate the data itself, we need to test the data structure returned from the API and verify it matches the expected API definition as in swagger, this includes :

- Response header status code

- Response header content type

- Response body data structure, this include

- Validating expected response data type (i.e. object or array .. etc)

- Each field of returned object should be present with correct type and format.

- API endpoints and other sensitive information should be configurable as environment variables.

- If you see any conflict between swagger definition and API definition/response please ask in forums for clarification from copilot/PM.

- Update the API swagger definition to include the error responses in each api route. It is currently missing. Each route should define all possible error responses from the call.

Naming Convention and Directory Structure

- Required filename for test is test.[api name].js (example: test.login.js).

- All tests from challenge winner should be put directly under test directory.

- All other test related files should be put under test_files directory.

- The tests should be setup and run independent of the current API source code/configurations.

Technology

You will use Mocha in nodejs to develop the tests. Use latest nodejs stable version.

Documentation

Your submission will be used by the client to run it against different API implementations (client will implement their own API backend). Kindly make sure that your documentation is thorough and includes clear setup instructions.

 



Final Submission Guidelines

Deliverable

- All files that address the requirement.

- Updated swagger definition.

- README file for deployment instructions and configurations.

- Verification document to verify your work.

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30052590