Part 6 - Enabling Performance Testing with Generative AI: The Power of Design and Execution in Action
In my previous article (Part 5), I had talked about Harnessing Synthetic Data Creation with Gen AI for Business-Centric Performance Workloads - Synthetic Data with Gen AI. We came up with a template to create performance workloads keeping all stakeholders (business & tech teams). This was for a typical retail e-commerce client.
Building on our previous discussions, let's now delve deeper into how generative AI can revolutionize the process of designing and executing performance test scripts.
Designing Test Scripts with Generative AI
Let's revisit our e-commerce platform scenario. Recall that we have already created a series of synthetic workloads that closely mimic anticipated user behavior and system interactions. Now we need to turn these workloads into executable test scripts.
Consider one of our synthetic workloads: users navigating from the landing page to the product page, then adding an item to the cart, and finally proceeding to checkout. We'd want our performance test to simulate this exact sequence of actions.
Picking the right tool
But first, we need to figure out what tool to use first. Now typically a team should figured out what tool to use by this time. However, just for the sake of this article, let's assume that the team is not sure what is the best option for them. I would recommend the team use the following parameters to evaluate existing tools
Here is what a simple comparison matrix may look like. Please do keep in mind that these results are subjective and based on an extremely simple comparison.
Recommended by LinkedIn
Personally, I like Python and so Locust is usually the tool of choice for me.
Creating boiler plate code for your test framework
After picking your tool of choice, you need to create some sort of test framework that makes it easy for you and your team to design, create, edit, execute, report and maintain your test suites. This can be a daunting task for many - especially given the pressure that teams face in terms of bandwidth and timelines to get things done. What better way than to use Gen AI to help design this for us.
Using the workload that we agreed upon with business (above), we can feed that into Gen AI and get it to create a project structure for us with the tool of our choice. We can make sure it follows clean, secure code, and SOLID principles to ensure that the resultant boilerplate code is easy to use. To demonstrate the use of Gen AI for this purpose, I am using the following dummy e-commerce site that can be used for performance testing.
I fed in the sitemap along with my required performance workload to get a complete project structure using Locust.
I can go one step deeper and even develop the code for the files. I shy away from using Gen AI for coding as there are still open questions over the source of training data with code. Given the open questions over the use of Gen AI to code, I would recommend not using it to code on production systems.
The next step involves generating test data for the tests, running the tests and presenting back the results with the stakeholders.
I will cover this in my next article. Until then, look forward to your thoughts on this article and look forward to any discussions on this.