TNS
VOXPOP
Favorite Social Media Timesink
When you take a break from work, where are you going?
Instagram/Facebook
0%
Discord/Slack
0%
LinkedIn
0%
Video clips on TikTok/YouTube
0%
X, Bluesky, Mastodon et al...
0%
Web surfing
0%
I do not get distracted by petty amusements
0%
AI / Large Language Models / Software Testing

Using ChatGPT to Create Software Tests

Let's walk through creating a simple unit test and a load test, and how you can run them in Kubernetes using Testkube.
Jun 28th, 2023 9:15am by
Featued image for: Using ChatGPT to Create Software Tests

It’s an exciting time for software testers as advancements in AI tools for testing are paving the way for more efficient QA processes. Developers, testers and site reliability engineers are leveraging AI-powered software testing tools like never before, integrating them into their agile development workflow.

At KubeCon EU in Amsterdam a few months back, I realized that AI is mentioned in a lot of cloud native projects. In most cases companies use AI gimmicks for marketing and don’t achieve anything meaningful with AI. However, there have been a few particular cases where it has drastically changed the way developers achieve certain tasks.

Role of AI in Software Testing

It was only when ChatGPT went viral this year that suddenly we saw something that we could call the “gold rush” of AI, where companies that didn’t have any talent in AI suddenly were releasing features with the AI brand. As with any tech trend, such as the dot-com bubble and crypto hype, many predict an influx of AI-branded features in the next few years, but as we know from history, only a select few will deliver long-lasting value.

For me, the intersection of AI and software testing presents an intriguing challenge. Using AI to create software is one thing, but employing it to test existing software is another ballgame altogether.

In my exploration of AI in software testing, I’ve discovered fascinating patterns among my colleagues at Testkube who regularly employ AI tools for testing. Often, they instruct the AI model to test specific elements by either describing the desired test or providing pieces of source code for analysis.

Using ChatGPT and Testkube

So how can you use ChatGPT to create a test and run it? Whether you’re looking into unit testing, integration testing, end-to-end testing, API testing or load testing, ChatGPT has you covered. Let’s walk through creating a simple unit test and a load test, and how you can run them in Kubernetes using Testkube.

Let’s look at how easy it is to create a unit test by giving ChatGPT our code as input.

Just like that, a unit test is created with ChatGPT.

Now, let’s create a load test from scratch, without giving any code to ChatGPT.

We’ll ask ChatGPT to: “Create a test using K6 load testing tool that checks if the website demo.testkube.io is responding in less than 200 milliseconds. Simulate 20 virtual users; the duration should be 10 seconds.”

Conclusion

Consider the time you’d have saved using AI for software testing, not to mention the speed of test automation using AI tools like ChatGPT and Testkube. While great tools can’t replace good software testers, those who use these tools are definitely at an advantage.

Give it a Try

Interested in AI in software testing? Here’s how you can access ChatGPT’s website. Once you’ve created your tests, use Testkube to execute and automate your tests quickly with Kubernetes.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Pragma, Unit.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.