Automated Web Service API Testing via Source Code Annotation Extraction
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing automated testing methods for web service APIs are time-consuming and require frequent updates due to the need for manual configuration files and separate tools to extract API-related details, limiting true automated test case generation.
Innovation Solution
A system and method that automatically extracts API-related details from annotations in the code of a resource class, eliminating the need for configuration files and manual intervention by using metadata to create test cases, thereby providing a web application-agnostic solution for automated testing.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Extent of automation
If manual configuration files are used for automated test case generation, then test cases can be generated automatically, but the process requires frequent updates and maintenance of configuration files
Solution Approach 1:
The system performs self-service by automatically extracting API metadata from source code annotations and generating test cases without requiring manual configuration file creation or updates. The test generation process consumes API metadata directly from the codebase, eliminating the need for separate configuration files that require maintenance.
Solution Approach 2:
API metadata is extracted from source code annotations during the build process or beforehand, preparing the necessary information for test case generation in advance. This preliminary extraction of metadata from annotations ensures that test cases can be generated automatically without requiring manual configuration file updates when the API changes.
2Measurement precision
If separate tools or dedicated endpoints are used for extracting API details, then comprehensive API information can be obtained, but the process becomes time-consuming and complex
Solution Approach 1:
The system merges the API metadata extraction and test case generation processes into a single integrated solution. Instead of using separate tools or dedicated endpoints for extracting API details, the system combines these functions by directly parsing annotations from the resource class code, thereby reducing complexity while maintaining comprehensive API information extraction.
Solution Approach 2:
The test generation system is designed to be universal by extracting API metadata from standard annotations that can be applied across different web service frameworks and languages. This multi-functional approach allows the same mechanism to extract various API details (endpoints, parameters, data models) without requiring framework-specific tools or endpoints.
3Reliability
If configuration files are updated manually to incorporate API changes, then test cases can reflect current functionality, but the process is not truly automated and requires manual intervention
Solution Approach 1:
The system achieves true automation by automatically detecting API changes through source code annotations and regenerating test cases without any manual configuration file updates. The process consumes metadata directly from the codebase, ensuring test cases always reflect current API functionality while maintaining full automation.
Solution Approach 2:
The system implements feedback by continuously monitoring API metadata from source code annotations and automatically updating test cases when changes are detected. This feedback loop ensures that test cases remain synchronized with the current API implementation without requiring manual intervention to update configuration files.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
Existing methods of automated testing of web service APIs require additional tools to extract API related details and configuration files to create test cases. The method and system disclosed herein taps annotations present in code of web service APIs to extract API related details and creates test cases using the extracted data. The method disclosed herein describes an approach to identify resource classes related to a plurality of web service APIs using built-in annotations in code of web application under test. Further, the identified resource classes are scanned to extract API related details (metadata) using built-in annotations and annotations given by a developer. Further, the extracted metadata is forwarded to a test engine server which generates a plurality of test cases using the extracted metadata. Further, the plurality of web service APIs are tested using the generated test cases.