Open niveathika opened 8 months ago
Explored Swagger Codegen, OpenAPI Generator, Dredd, OpenAPI Testers, and the fancy ones like EvoMaster, Karate, and Tcases.
What I Found:
Code Generators: Swagger and OpenAPI Generator are good for code but a bit lackluster on test cases. They throw in basic service calls and leave assertions to developers.
Testing Tools: Dredd and OpenAPI Testers check if your API follows rules but don't guide much on creating meaningful test cases.
Specialized Solutions: EvoMaster shines with AI algorithms.
Please refer OpenAPI specification validation for more research into existing solutions.
Generating test cases from OpenAPI specs is tricky. Tools are cool but fall short. AI is an option, but it comes with a hefty price tag.
My suggestion? Hold off on the test case generation feature for now. Wait until the need outweighs the cost. Keep it practical.
I will be looking into mock services next.
I've explored two methods for mocking external endpoints to test our client:
Ballerina Mock Functionality:
http:Client
to the global level.Bal OpenAPI CLI for Mock Server:
bal openapi
CLI to generate a mock server, added as a submodule.In summary, the second approach leveraging the Bal OpenAPI CLI for generating a mock server appears more flexible, readable, and suitable for diverse testing scenarios. While it requires additional effort for authenticated servers, its advantages in code readability and versatility make it a promising choice.
Note: The progress has been delayed as I've encountered issues with Testerina. #41825 #41821
After evaluating, we have decided generate the service skeleton from the bal openapi tool and fill it with dummy values for the time being with the other priorities
Description: This proposal introduces two new features to the OpenAPI to Ballerina CLI tool:
Currently, the tool's primary function is to generate Ballerina code from OpenAPI specifications.
The proposed features aim to enhance the developer experience by:
Additional Benefits
Scenario Testing: This allows for comprehensive scenario testing, ensuring the application's robustness and resilience.
Reduced Dependencies: These features enable developers to work independently on their components, minimizing dependencies and eliminating bottlenecks in the development process.
Enhanced Test Coverage: Automated test generation based on the OpenAPI contract ensures extensive test coverage, reducing the likelihood of unnoticed bugs.
Efficient API Contract Validation: Developers can validate the API contract early and continuously during development, ensuring that the documentation and implementation are aligned.