SDET Take-Home Assignment: API Testing Challenge
Objective
Evaluate your coding, reasoning, and automation skills by creating and executing
test scripts for a set of RESTful API endpoints with mocked data. Use your
experience and creativity to decide the best tools, frameworks, and test
scenarios.
Assignment Description
You are tasked with automating the testing of the following RESTful API
endpoints. The goal is to verify their functionality, handle edge cases, and ensure
proper error handling. Mock data should be used to simulate API responses
where required.
Endpoints for Testing
1. Authentication
• POST /api/v1/auth/register: Register a new user.
• POST /api/v1/auth/login: Log in and return an authentication token.
• GET /api/v1/auth/logout: Log out the user (requires authentication).
2. Products
• GET /api/v1/products: Retrieve all products.
• POST /api/v1/products: Create a new product (admin only).
• DELETE /api/v1/products/:id: Delete a product by ID (admin only).
3. Reviews
• GET /api/v1/reviews - Get all reviews.
• GET /api/v1/reviews/:id - Get a single review by ID.
• POST /api/v1/reviews - Create a new review.
• PUT /api/v1/reviews/:id - Update a review by ID.
• DELETE /api/v1/reviews/:id - Delete a review by ID.
4. Orders
• GET /api/v1/orders - Get all orders (admin only).
• GET /api/v1/orders/:id - Get a single order by ID (admin only).
• POST /api/v1/orders - Create a new order.
• PUT /api/v1/orders/:id - Update an order by ID (admin only).
• DELETE /api/v1/orders/:id - Delete an order by ID (admin only).
Task Requirements
Design and automate tests to validate the functionality, error handling, and edge
cases for all the provided endpoints. Focus on ensuring:
• Proper behavior for both successful and failed operations.
• Handling of various input conditions (valid, invalid, and missing data).
• Correct implementation of access control and authentication
mechanisms.
Mock Data
• Use mock data to simulate API responses for users, products, and
tokens.
Test Coverage
Focus on covering a mix of functional, edge-case, and negative test
scenarios. Use your discretion to determine what additional cases should
be tested based on your experience.
Deliverables
i) Automation Code
(1) Submit the source code for your automated tests (Github link)
(2) Ensure the code is easy to run and configure, with clear instructions
provided for execution (e.g., via a README or comments).
ii) Execution Results
(1) Share logs or outputs from running your test scripts.
(2) Highlight any failed test cases and the reasons for failure.
iii) Evaluation Criteria
(1) Reasoning Skills: Selection of test scenarios, prioritization of edge cases,
and creativity in handling complex scenarios.
(2) Coding Quality: Clean, maintainable, and modular code.
(3) API Testing Expertise: Understanding of API mechanics, including
authentication, error handling, and response validation.
(4) Automation Strategy: Efficient use of tools and techniques for test
automation, with robust handling of test data and dependencies.
(5) Practicality: Real-world applicability of the test cases and the ability to
simulate realistic scenarios with mock data.
Notes
• You are free to use any tools, frameworks, or libraries for this task.
• The focus is on showcasing your approach and ability to think critically
about API testing, not just the tools you choose.
• Be concise but thorough in your test scenarios and implementation.