DongThin / my-love-e2e-testing

e2e testing with cypress
2 stars 0 forks source link

REST API Automation Training (Without automation framework) #16

Open alang-dev opened 1 month ago

alang-dev commented 1 month ago

As part of the training on REST API automation testing, you are tasked with developing automated tests for a REST API using JavaScript's Fetch API along with Mocha and Chai libraries.

Requirements:

  1. Test Suite:

    • Create a test suite for the REST API tests using Mocha.
    • Organize test cases into meaningful categories (e.g., endpoints, functionality).
  2. Test Cases:

    • Write test cases to cover various scenarios of API endpoints (e.g., GET, POST, PUT, DELETE).
    • Ensure to include positive and negative test cases, boundary cases, and edge cases.
    • Test different request methods, request parameters, headers, and response status codes.
    • Test for valid and invalid responses, error handling, and edge conditions.
    • Test for file upload/download
  3. API Requests:

    • Utilize JavaScript's Fetch API to send HTTP requests to the API endpoints.
    • Write functions to perform API requests and handle responses using Fetch API.
    • Handle authentication if required by the API.
  4. Assertions:

    • Use Chai assertions to verify the correctness of API responses.
    • Verify response status codes, response body content, headers, etc.
  5. Reporting:

    • Ensure that test results are clearly reported, indicating which tests passed and which failed.
    • Use Mocha's reporting features or integrate with other reporting tools if necessary.
alang-dev commented 1 month ago

Precondition: