Skip to content

Enhance API Test Coverage with Schema Fixes, Parameterization, and PATCH Validation#234

Open
Vamsi280300 wants to merge 1 commit into
automationExamples:mainfrom
Vamsi280300:main
Open

Enhance API Test Coverage with Schema Fixes, Parameterization, and PATCH Validation#234
Vamsi280300 wants to merge 1 commit into
automationExamples:mainfrom
Vamsi280300:main

Conversation

@Vamsi280300
Copy link
Copy Markdown

Overview

Enhanced and completed API test suite using pytest by fixing existing issues, improving test coverage, and validating API behavior more thoroughly.

Key Improvements:

  1. Fixed Existing Test Failures
    Resolved inconsistency in API access (localhost vs 127.0.0.1) causing 403 errors
    Corrected JSON schema mismatch where name field was incorrectly defined as integer instead of string

  2. Enhanced Test Coverage
    Extended parameterized tests for /pets/findByStatus to include all valid statuses (available, pending, sold)
    Added validation for response structure and schema for each returned object
    Implemented edge case testing for invalid and non-existing pet IDs

  3. Implemented PATCH API Testing
    Added test for successful PATCH request with response validation
    Validated response message: "Order and pet status updated successfully"
    Added negative test cases:
    Invalid payload handling
    Non-existing resource handling
    Implemented persistence validation to ensure data updates are reflected in subsequent GET requests

  4. Code Quality Improvements
    Removed unused imports
    Improved test readability and structure
    Ensured consistent and deterministic test behavior

Bugs Identified
API access inconsistency when using localhost vs 127.0.0.1
Schema definition mismatch for name field in schemas.py
Potential lack of strict validation for PATCH payload types

Summary
This update improves reliability, coverage, and maintainability of the API test suite while identifying key inconsistencies in API behavior and schema definitions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant