Enhance API Test Coverage with Schema Fixes, Parameterization, and PATCH Validation#234
Open
Vamsi280300 wants to merge 1 commit into
Open
Enhance API Test Coverage with Schema Fixes, Parameterization, and PATCH Validation#234Vamsi280300 wants to merge 1 commit into
Vamsi280300 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Enhanced and completed API test suite using pytest by fixing existing issues, improving test coverage, and validating API behavior more thoroughly.
Key Improvements:
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
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
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
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.