Project Link
GitHub
Project Description
This project covered the "Introduction to JavaScript" chapter and encompassed writing tests for GET, POST, PUT, and DELETE requests using the Urban Grocers API. The project included 5 total tasks, with the first four tasks writing two tests each for the requests previously mentioned.
The documentation source used was apiDoc, which can be accessed via the server URL provided on the project page and including "/docs" at the end of the URL. apiDoc was used to check endpoints and verify the various tests, including status codes and the response body of requests.
The Postman platform was used to send the requests using the provided server URL. Postman be accessed via https://www.postman.com/ or downloaded to be used on a desktop. The GET, POST, PUT, and DELETE requests were tested using the provided server URL and the endpoints outlined in apiDoc.

The Testing Process
- Analyze the apiDoc and Swagger of Urban Grocers API
- Familiarize with all API endpoints.
- Understand the parameters, data types, and return values.
- Note the HTTP methods (GET, POST, PUT, DELETE, etc.).
- Identify inconsistencies or errors in the documentation.
- Prepare and Execute Tests Through Postman
- Set up a Postman environment with the necessary variables.
- Import the Swagger file to Postman for a ready set of tests.
- Execute tests for each endpoint with various scenarios.
- Use assertions to validate response structure, status codes, and response times.
- Save the tests for regression and automation purposes.
- Execute GET, POST, PUT, and DELETE Requests
- The GET request used was {{server_url}}/api/v1/kits/1
- After inputting the URL, endpoint and clicking "Send", the status code and response body are verified
- The POST request used was {{server_url}}/api/v1/orders
- JavaScript data was added to the body before sending the request
- The status code and response body are verified after sending the request
- The PUT request used was {{server_url}}/api/v1/kits/5
- I chose kit #5 to change, changing the quantity in the code body and changing the product name from "Pasta", to "Spaghetti"
- The staus code and response body are verified after sending the request
- Checking the kit using the GET request shows the kit had been changed
- The DELETE request used was {{server_url}}/api/v1/kits/7
- After inputting the URL, endpoint, and clicking "Send", the status code and response body are verified
- Checking the kit using the GET request shows the kit is deleted
- Automation Testing
- The templates for the tests provided in the project folder were opened via Visual Code which can be accessed at https://code.visualstudio.com/ and downloaded to be used on desktop.
- After opening each file, two tests were run for each request mentioned above; one to check the response code, and the other to parse the response and check that the response body contains the expected data.
- The tests were run using the terminal within Visual Code and the npx jest command.
- Technologies Used
- WebdriverIO: Automation tool for web applications, used for writing and running automated tests.
- Node.js: JavaScript runtime environment that allows the execution of JavaScript on the server side.
- Mocha: JavaScript test framework running on Node.js.
- JavaScript: Primary programming language used to write the test scripts.
- SelectorsHub: Tool to inspect and generate selectors in the browser, used to identify and verify elements during test creation.
- Visual Studio Code: Code editor used to write and debug automated test scripts. This was also used as the terminal for creating project files and executing tests.
- Firefox: Browser used for automated testing of the Urban Routes web application.
- MacOS Sonoma Version 14.4.1: Operating system used to complete Project 8.
- Techniques Used
- End-to-End Testing: Verify the Urban Grocers web application functions correctly during the process of a customer placing a grocery order.
- Modular Code Organization: Separate files for test scripts (
postHandlers.test.js), (getHandlers.test.js), (putHandlers.test.js), (deleteHanlders.test.js) for better maintainability and code organization.
- Assertions: Use WebdriverIO's built-in assertion library to validate the expected outcomes of tests.
- Element Interactions: Automate user interactions with web elements including clicks, inputs, and waits.
- Timeouts and Waits: Ensure elements are available before interactions.
- Writing a Bug Report in Jira
- Write a concise, clear title.
- Provide a detailed description, steps to reproduce, and the expected vs. actual outcome.
- Attach any relevant evidence (screenshots, logs, etc.).
- Label the bug, assign it to the right team member, and indicate its severity.
A Server Link and access to the Jira Bug Report can be provided upon request.