Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Versions You will be using the following tools with these versions Node: 14.3.0 Cucumber. 6.0.5 Supertest: 4.0.2 Mocha: 7.1.1 Create a test suite for API

image text in transcribed

Versions

You will be using the following tools with these versions

Node: 14.3.0

Cucumber. 6.0.5

Supertest: 4.0.2

Mocha: 7.1.1

Create a test suite for API verification of a new application. The team has provided you with an api.feature file, which has been written in Gherkin syntax using the BDD approach. Your role is to create a set of tests using the tools that have already been set up and whose specification has already been defined in the Feature file Cucumber for Gherkin and test integration, and the supertest library for testing the application's API. Test cases explained - The first test defined in the Feature file should verify whether the endpoint /users, on sending a GET request, returns in its response the expected list of users. In this case it should be a JSON file such as: [ [ "name" : "anna" , "email" : "anna@codility.com" },{ "name" : "bob", "email" : "bobecodility .com" } " - The second test should verify whether, on sending a GET request to the endpoint ew/, the response returns a welcome to the new page! message. - The next test should check whether sending a GET request to the root path endpoint / results in a redirect to the ew endpoint, status code 301 and a message Moved Permanently. Redirecting to ew. - The fourth test should confirm that sending a GET request to a onexisting endpoint returns a 404 status code in the response. - The final test should verify whether, on sending a POST request to /users with the user name and user email, the expected message is returned. For those tests, the scenario anna@codility.com, should differ from other cases. Disclaimer Your solution will be run against multiple correct and incorrect versions of the implemented application. If the tests don't pass for the correct implementation, your task will be evaluated as 0% score. Do not edit the api. feature file or your solution will fail to compile and you will receive a 0% score. Also, do not remove the included imports

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions