Can ChatGPT Write Testing Automation for Tools Like Selenium, Cypress, and Playwright? |

Can ChatGPT Write Testing Automation for Tools Like Selenium, Cypress, and Playwright? |

With over one million users in only five days, ChatGPT is the newest innovation in natural language processing that has taken over the internet by storm.

The free AI chatbot, just recently launched, gained instant notoriety owing to its capacity to answer questions, clearly explain ideas, or carry out challenging tasks like composing a song or explaining complex mathematics.

Given that ChatGPT can create test cases in various frameworks and languages, there are significant implications for automated testing for online and mobile app developers.

So let’s read about used to, uses and limitations of ChatGPT and investigate the options.

  • ChatGPT, developed by OpenAI, is a substantial language model that was improved using supervised and reinforcement learning on huge datasets. ChatGPT examines the data using algorithms to look for patterns that aid in its comprehension of natural language and word use. Because it is a dialogue-based paradigm, it is intended for back-and-forth communication. If the system doesn’t deem it objectionable, you can ask ChatGPT whatever you like.
  • ChatGPT is capable of generating insightful and pertinent comments, frequently outlining the rationale behind each one. To conduct a coherent dialogue, it can also recall its prior replies. You can ask it to generate anything from writing a fictional novel to questions about molecular biology.
  • Automation Testing involves writing code (usually in a scripting or programming language) to automatically execute test cases and validate if the application under test behaves as expected.
  • This helps to reduce the time and effort needed for manual testing, increase the speed and accuracy of testing, and improve the overall quality of the software.
  • Testing Automation can be used for an application’s functional, regression, and performance testing.
  • The Test Code interacts with the application by simulating user actions and verifying the output. Popular languages for automation testing include Java, Python, Ruby, JavaScript, and C#.
  • One of ChatGPT’s most intriguing aspects is its ability to produce correctly structured and pertinent code from a straightforward natural language request. It may leverage several built-in packages across various languages and create code in various languages. The logical inquiry that follows is whether ChatGPT can provide code for automated testing.
  • Right now, the answer is “Yes, sort of.” Despite that, it should be noted that it cannot replace the role of skilled programmers, professors, or mentors. It may be a fantastic learning tool, but it should be combined with other materials and advice from seasoned programmers.
  • However, this is only the beginning of being able to create code that looks accurate. In a perfect world, one would give ChatGPT a description of the test to create, it would be aware of every aspect of the website version being tested, and it would provide flawless, executable code that doesn’t require any alterations. Not right now, according to ChatGPT. However, what it is capable of is still rather remarkable.

Prompt: “Write Cypress/ Javascript code for opening the URL of the site http://testgrid.io

ChatGPT:

  • Consider that you wish to plan the test automation for a website called testgrid.io, which you have developed some features.
  • In these situations, you may utilize GPT by providing information about the functional components and how they are used, then asking it to produce a test plan.

Prompt:testgrid.io is a website. Prepare a test plan for an automation test to carry out the following validation on the website: Open testgrid.io. Success if the page loads with the title ‘TestGrid TestOS — The first-choice OS for End-to-End Testing’”

ChatGPT:

In this situation, you may use ChatGPT by prompting further in the same thread:

Prompt: “Prepare test case table to enter into Jira tickets “

ChatGPT:

  • Errors in the code: Since it is still in the Beta phase, chatGPT code may have errors or be less efficient, and it may not always function properly due to a lack of understanding of the task’s unique context or needs. Before utilizing the produced code in any project, it is crucial to check and test it properly.
  • Factual mistakes: Since ChatGPT was trained on a sizable amount of text data, it is likely that the factual mistakes or disinformation that were included in the training data ended up in the model.
  • Lack of domain expertise: Although ChatGPT may produce language that resembles human writing, it could fall short in some areas of particular subject knowledge or expertise compared to a human expert.
  • Biases: The model may have picked up biases from the enormous amount of text data gathered from the internet it was trained on. As a result, offensive or inappropriate content may be produced.

Originally published at testgrid.io on February 7, 2023.