Open waynehamadi opened 3 months ago
Disclaimer: This comment was automatically generated with AI. It can give some useful hints as to where to look for, but sometimes it can also give very inaccurate answers so takes this with a pinch of salt :).
To automate QA for all REST endpoints based on OpenAPI, follow these steps:
Generate Postman Tests: Use the postman-contract-test-generator
to generate Postman tests from your OpenAPI spec.
Locate OpenAPI Spec: Ensure your OpenAPI spec is up-to-date. It is typically found in the twenty-server
package.
Integrate Tests: Integrate the generated Postman tests into your CI/CD pipeline. This can be done by adding a script in your package.json
:
"scripts": {
"test:api": "newman run postman_collection.json"
}
Run Tests: Execute the tests using the command npm run test:api
.
Handle Responses: Ensure your response handlers in twenty-server/src/handlers
are correctly processing the responses as per the OpenAPI spec.
Update Endpoints: Fix any failing endpoints as identified by the tests. Refer to twenty-server/src/routes
for endpoint definitions.
This will help in automating the QA process for your REST endpoints.
See here: https://github.com/allenheltondev/postman-contract-test-generator
You need something like that, a lot of rest endpoints don't work, and it's so much work to test all of them.
I asked Allen if he built something even better: https://x.com/waynebluewind/status/1794701810709475329