As I was basking in the sun on this Himalayan winter morning, it hit me what if I could generate all my test scenarios (which I often write in Cypress.io) using OpenAI ChatGPT. Following is the documentation of what I have found (TL;DR QA Automation engineers are safe for now 😉)
For those of you who have been living under a rock, OpenAI ChatGPT is a conversation language model which can answerquestions, followup questions, admit its mistakes, challenge incorrect premises, and reject inappropriate requests.
more info: https://openai.com/blog/chatgpt/
I wanted to do minimal work, as I didn't want to explain everything first to the ChatGPT language model, so I took the liberty of finding a simple OpenAPI CRUD swagger spec https://gist.github.com/Daniyal-Javani/5b91ed8c492d62a528ebb7d61ceeb419 and converted it to following swagger.json with little modification
I started with a basic question:
I followed up with
The Ultimate Question:
ChatGPT generated a sample code in cypress:
After fixing some Syntax issues in this generated Code and adding a mocked baseUrl
you can use Mockoon an excellent tool to create a mock server based on the OpenAPI Spec used in this article above
Let us validate these generated tests in a Cypress project:
Even though the generated test Scenarios are greater than the actual test generated by ChatGPT.
Based on this small exercise, it is safe to say QA Automation engineers are safe for now :D
Shout out to Mockoon, which is an excellent API mocking solution, the bit I liked most about this tool is how easy it is to create a mock server based on the OpenAPI 3 spec
More on ChatGPT:
Until Next Time!! 👋