Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your team is at the very beginning of the process of creating a new application. At this early stage, a backend application is already running

image text in transcribed

Your team is at the very beginning of the process of creating a new application. At this early stage, a backend application is already running with a few completed endpoints. Your task is to create five basic API tests to cover cases defined in the team's Test Plan. You're going to use the Javascript language and already installed modules: superTest used for API calls and assertions and MochaJs test runner. Task 1. The first test, named API Test returns JSON with a list of users, should check whether, for a gET request sent to the endpoint /users, the application returns correct data. It should return valid Json with a list of users and their name and id key/value pairs. Make sure that the returned list includes mocked up users: john doe with id 1 and anna boe with id 2 . and "welcome to the new page" value. 3. The third test, API Test endpoint onexisting returns 484 status, should check that the backend application properly handles nonexistent endpoints. To verify that, send a GET request to the endpoint named onexisting and verify that it returns a 404 status code. sending a get request to the root path, the returned status code should be 301. 5. The last test, named API Test adding new user to the list, should confirm whether, on sending a POST request to the endpoint /users, the new user is added to the existing users list. The POST request should include the parameter name set to new user's user name. For this test you can use the user name from the NEW_USER_NAME constant, defined at the top of your solution file. On success, the endpoint should respond with a message: has been added to the users list, where is the sent value. Disclaimer Your solution will be run against multiple correct and incorrect versions of the implemented application. If your tests fail to pass the correct implementation, your task will be evaluated as a 0% score. Available packages and libraries - Mocha version 7.2.0 - SuperTest version 4.0.2

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

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions