What happens when hundreds, thousands or even millions of users access an application at the same time? Will the website continue responding quickly? Can the system process transactions without errors? Will the application remain stable during peak traffic?
These are the questions performance and load testing are designed to answer.
As applications become more complex and customer expectations continue to rise, software teams need efficient ways to evaluate application speed, stability, scalability and reliability. Traditional performance testing often requires testers to understand scripting, create realistic workloads, configure test environments and analyse large volumes of performance data.
Artificial intelligence is adding a new layer of assistance to this process. With well-designed prompts, AI tools can help QA professionals generate test scripts, create workload scenarios, explain scripting logic, identify potential test gaps and interpret performance results.
In this guide, we explore how AI-assisted scripting can accelerate performance and load testing, with practical examples using Apache JMeter and Grafana k6. We will also examine the skills QA professionals need to use these tools effectively in modern software testing environments.
1. Understanding Performance Testing and Load Testing
Performance testing is a broad category of software testing that evaluates how an application behaves under different workloads and operating conditions. It helps teams understand whether an application meets defined expectations for speed, responsiveness, stability and resource usage.
Load testing is one type of performance testing. It evaluates how a system performs under an expected or anticipated level of user activity.
For example, consider an e-commerce website that normally receives 500 concurrent users but may experience 5,000 concurrent users during a major promotional campaign. A load test can help determine whether the application can support the anticipated traffic while maintaining acceptable response times and error rates.
Performance testing commonly examines:
- Response time: How long the application takes to respond to a request.
- Throughput: How many requests or transactions the system processes over a period of time.
- Concurrent users: How many users or virtual users are active at the same time.
- Error rate: The proportion of requests that fail or return unexpected results.
- Resource utilisation: CPU, memory, network and database resource consumption.
- Scalability: How effectively the system handles increases in workload.
- Stability: Whether the application continues operating reliably over an extended period.
2. Different Types of Performance Testing
Before generating a performance test script, QA professionals need to understand what they are trying to measure. Different test types answer different questions.
Load Testing
Load testing evaluates application behaviour under expected user traffic. It helps establish whether the system can handle normal and anticipated peak workloads.
Stress Testing
Stress testing pushes an application beyond its expected operating capacity to identify its breaking point, failure behaviour and recovery characteristics.
Spike Testing
Spike testing evaluates how an application responds to sudden increases or decreases in traffic. This is useful for systems that experience unpredictable demand, such as ticket booking platforms or online retail websites.
Endurance or Soak Testing
Endurance testing evaluates system performance over an extended period. It can help identify memory leaks, resource exhaustion, connection problems and gradual performance degradation.
Scalability Testing
Scalability testing examines how effectively an application handles increasing workloads as additional computing resources are introduced or infrastructure capacity is expanded.
AI can help QA professionals draft scripts for these different test objectives, but the workload model and success criteria must come from an understanding of the application and its expected usage.
3. Why AI Is Changing Performance Test Scripting
Traditional performance test scripting requires a combination of technical knowledge and test design skills. A tester may need to understand HTTP requests, authentication, session management, dynamic parameters, test data, virtual users and performance metrics before a script can accurately represent a real user journey.
AI-assisted scripting can reduce some of the repetitive work involved in this process.
For example, a QA professional can describe a user journey in plain language and ask an AI tool to produce an initial k6 JavaScript script or explain how to configure an Apache JMeter test plan.
AI can assist with several activities:
- Script generation: Creating draft scripts from API specifications, user journeys or test requirements.
- Script explanation: Explaining unfamiliar functions, parameters, assertions and configuration options.
- Test scenario design: Suggesting workload patterns such as gradual ramp-up, sustained load and sudden traffic spikes.
- Test data preparation: Helping design representative, synthetic test data.
- Script improvement: Identifying duplicated logic, missing checks and opportunities to make scripts more reusable.
- Performance analysis: Helping interpret response-time distributions, throughput, error rates and resource metrics.
- Documentation: Producing test summaries, execution notes and draft performance reports.
The important distinction is that AI can accelerate script development and analysis, but it does not automatically make a test realistic or its results reliable. The QA professional must validate the script, workload, environment and interpretation.
4. Generating Performance Test Scripts with AI Prompts
One practical way to use AI is to provide a detailed description of the application, the user journey and the expected workload. The AI tool can then generate an initial script for review.
Example: Testing an E-commerce Application
Imagine an online shopping platform with the following customer journey:
- A customer opens the website.
- The customer searches for a product.
- The customer opens a product details page.
- The customer adds the product to the shopping cart.
- The customer proceeds to checkout.
A basic request to an AI tool might be:
Generate a load testing script for an e-commerce website.This instruction is too broad. It does not specify the technology, endpoints, authentication, expected workload, test duration or success criteria.
A better prompt provides the required context.
Practical AI Prompt: Generate a k6 Load Test Script
Act as a senior performance testing engineer
experienced with Grafana k6 and JavaScript.
I need to create a performance test for an
e-commerce application's product search API.
Test requirements:
1. Send HTTP GET requests to the product search endpoint.
2. Use a configurable search query.
3. Simulate a gradual increase to 50 virtual users.
4. Maintain the target load for 2 minutes.
5. Gradually reduce the load at the end.
6. Validate that the response status is successful.
7. Capture HTTP response time and request failure metrics.
8. Define configurable performance thresholds.
Please:
- Generate a complete k6 JavaScript script.
- Use environment variables for the base URL and search query.
- Add appropriate checks and thresholds.
- Include comments explaining each section.
- Avoid hardcoding credentials or sensitive information.
- Identify assumptions and configuration values
that need confirmation.
Do not invent API endpoints or response structures.
Use placeholders where information is missing.This prompt gives the AI a clear role, technology, test objective and expected output. It also prevents the model from pretending to know application-specific information that has not been supplied.
5. Example: AI-Assisted k6 Performance Test Script
Grafana k6 is an open-source performance testing tool that allows testers to write scripts in JavaScript. It supports virtual users, workload scenarios, performance thresholds and multiple ways to execute tests.
The following is an illustrative example of a basic k6 script. The endpoint is a placeholder and must be replaced with an approved test endpoint before execution.
import http from 'k6/http';
import { check } from 'k6';
export const options = {
stages: [
{ duration: '30s', target: 10 },
{ duration: '1m', target: 50 },
{ duration: '2m', target: 50 },
{ duration: '30s', target: 0 },
],
thresholds: {
http_req_failed: ['rate<0.01'],
http_req_duration: ['p(95)<500'],
},
};
export default function () {
const baseUrl = __ENV.BASE_URL;
const response = http.get(
`${baseUrl}/api/products?search=laptop`
);
check(response, {
'status is 200': (r) => r.status === 200,
});
}In this example:
- Stages: Gradually increase the virtual users, maintain the workload and then reduce it.
- http.get: Sends an HTTP GET request to the product search endpoint.
- check: Verifies that the response status is 200.
- http_req_failed: Defines an acceptable request failure rate.
- http_req_duration: Defines a response-time threshold for the 95th percentile.
- __ENV.BASE_URL: Allows the base URL to be supplied through an environment variable rather than hardcoded in the script.
The example thresholds are demonstration values, not universal performance standards. Actual thresholds should be based on the application's service-level objectives, business expectations and baseline measurements.
Before execution, confirm the endpoint, authentication requirements, test data, expected response and permitted traffic level. A script that sends technically valid requests may still fail to represent realistic customer behaviour.
6. Using AI to Create Apache JMeter Test Plans
Apache JMeter is another widely used open-source tool for performance and load testing. It supports test plans containing thread groups, samplers, controllers, timers, assertions, configuration elements and listeners.
Unlike k6, where test logic is commonly written in JavaScript, JMeter test plans are typically configured through its graphical interface or represented in a JMX test plan file.
AI can help testers understand the components of a JMeter test plan and design the required configuration.
Example AI Prompt for JMeter
Act as an experienced Apache JMeter performance tester.
I need to create a load test for a customer login API.
Test objective:
Evaluate the login API under a controlled workload.
Requirements:
- Start with 10 virtual users.
- Gradually increase to 100 virtual users.
- Maintain the target load for 5 minutes.
- Use a configurable ramp-up period.
- Send HTTP POST requests.
- Use parameterised test data.
- Validate successful and unsuccessful responses.
- Capture response time and throughput.
- Explain how to configure the Thread Group,
HTTP Request Sampler, CSV Data Set Config,
HTTP Header Manager and Response Assertion.
Please provide:
1. A recommended JMeter test plan structure.
2. Configuration guidance for each component.
3. Example request body using placeholder credentials.
4. A list of required test data and assumptions.
5. Suggestions for analysing the results.
Do not include real credentials or invent API details.AI can explain how the different components work together. For example, a Thread Group controls the number of virtual users, ramp-up period and execution duration. An HTTP Request Sampler sends the request, while assertions can validate expected responses.
Testers can also use parameterised data to avoid sending identical requests from every virtual user. The data should be representative of the intended workload and should not contain real customer credentials.
7. Designing Realistic Workloads with AI
Generating a script is only one part of performance testing. A more important challenge is deciding what kind of traffic the application should receive.
A test that sends thousands of identical requests to a single endpoint may not accurately represent actual user behaviour. Real customers browse, search, log in, update information and complete transactions at different rates.
AI can help QA professionals turn business usage information into a proposed workload model.
Example: Workload Design Prompt
Act as a performance test architect.
Design a workload model for an online retail application.
Assume the following expected activity:
- Customers browse product categories.
- Customers search for products.
- Customers open product details.
- Customers add products to their carts.
- A smaller percentage of customers proceed to checkout.
Create a proposed workload distribution for:
1. Normal operating traffic.
2. Expected peak traffic.
3. Sudden traffic spikes.
4. Extended sustained traffic.
For each workload:
- Explain the test objective.
- Recommend a traffic pattern.
- Identify the required user journeys.
- Suggest relevant performance metrics.
- List assumptions requiring business confirmation.
Do not assume that all users perform every action
or that all requests have the same frequency.The resulting workload model should be reviewed against analytics, business forecasts, production traffic patterns and agreed testing objectives.
Example Workload Distribution
The following is an illustrative distribution that a team might use as a starting point for discussion:
- 40% browsing product categories
- 25% searching for products
- 20% viewing product details
- 10% adding products to the cart
- 5% proceeding to checkout
These percentages are not industry benchmarks. A real workload model should reflect the application's actual user behaviour and business requirements.
8. AI-Assisted Performance Analysis: Finding Bottlenecks Faster
After a performance test has been executed, QA professionals need to interpret the results. This often involves reviewing response-time distributions, throughput, failed requests, server logs and infrastructure metrics.
AI can assist by explaining performance data, identifying unusual patterns and suggesting areas for further investigation.
For example, imagine a test report contains the following illustrative results:
- Average response time: 420 milliseconds
- 95th percentile response time: 1,250 milliseconds
- Request failure rate: 2.5%
- Throughput: 850 requests per second
- Database CPU utilisation: 92%
The average response time may appear acceptable, but the 95th percentile indicates that a significant portion of requests are taking considerably longer. The elevated database CPU utilisation may also justify further investigation.
Example AI Prompt for Performance Results
Act as a senior performance testing analyst.
Analyse the following test results:
Average response time: 420 ms
95th percentile response time: 1,250 ms
Request failure rate: 2.5%
Throughput: 850 requests per second
Database CPU utilisation: 92%
Please:
1. Explain what each metric indicates.
2. Identify potential performance concerns.
3. Suggest possible bottleneck areas.
4. Recommend additional monitoring data to collect.
5. Suggest follow-up tests to isolate the problem.
6. Separate confirmed observations from hypotheses.
Do not claim that a specific component is responsible
unless the evidence supports that conclusion.AI might suggest investigating database queries, connection pools, application server resources, caching or downstream dependencies. These are hypotheses, not confirmed root causes. The team must validate them using monitoring data, traces, logs and controlled experiments.
9. Performance Metrics Every QA Professional Should Understand
AI can help explain a performance report, but QA professionals need to understand the underlying metrics to make sound testing decisions.
- Average response time: The mean time taken for requests to complete. It can hide slow responses affecting a smaller portion of users.
- Median response time: The response time at the 50th percentile, representing the middle observation.
- 95th percentile: The response-time value below which 95% of measured requests completed.
- 99th percentile: A measure of slower requests that can reveal performance problems affecting a smaller portion of traffic.
- Requests per second: The rate at which the system processes requests.
- Error rate: The proportion of requests that fail according to the test's defined criteria.
- CPU and memory usage: Helps assess whether application or infrastructure resources are approaching capacity.
- Database performance: Includes query execution time, connection utilisation, locks and other database-related indicators.
One metric should never be interpreted in isolation. For example, high throughput is not necessarily a positive result if response times and error rates are also increasing.
10. Best Practices When Using AI for Performance Test Scripting
AI-generated scripts can save time, but performance testing is particularly sensitive to incorrect assumptions. A poorly configured test can produce misleading results or create unnecessary load on infrastructure.
QA professionals should follow these practices:
Validate every generated script
Review the generated code, request methods, endpoints, headers, authentication and assertions. Run a small smoke test before increasing the workload.
Use realistic test data
Use representative, approved and preferably synthetic data. Ensure that test data does not expose confidential customer information or production credentials.
Correlate dynamic values
Some applications generate session IDs, tokens, CSRF values and other dynamic data. Scripts may need to extract these values from one response and reuse them in subsequent requests. Without correlation, a script may fail or behave unlike a real user session.
Model realistic user behaviour
Consider think time, user journeys, request frequency, different user roles and traffic distribution. Avoid sending requests continuously without considering how real users interact with the application.
Define performance thresholds
Establish measurable acceptance criteria before running the test. Thresholds should reflect service-level objectives and business requirements, not arbitrary values generated by AI.
Monitor the load generator
The machine generating test traffic can itself become a bottleneck. Monitor its CPU, memory and network utilisation so that limitations in the test infrastructure are not mistaken for application performance problems.
Run tests only with authorisation
Load and stress tests can affect application availability and downstream systems. Obtain written approval, use designated environments where possible, agree on test windows and define safe traffic limits before execution.
11. Common Mistakes to Avoid in AI-Assisted Load Testing
- Testing without a clear objective: Every performance test should have a defined question, workload and expected outcome.
- Assuming virtual users equal real users: Virtual users, request rates and actual customer traffic are related but not interchangeable measurements.
- Using unrealistic traffic patterns: Repeated identical requests may not reflect real application usage.
- Ignoring authentication and session management: A script that does not handle tokens, cookies or sessions correctly may produce invalid results.
- Trusting AI-generated thresholds: Performance acceptance criteria must come from business and technical requirements.
- Skipping baseline measurements: Without a baseline, it can be difficult to determine whether a change has improved or degraded performance.
- Testing production without approval: Uncontrolled traffic can disrupt live services and affect real customers.
- Assuming AI has found the root cause: AI can suggest investigation paths, but root-cause analysis requires supporting evidence.
12. Skills QA Professionals Need for AI-Driven Performance Testing
Performance testing is not limited to writing scripts. It requires an understanding of application architecture, workload behaviour, data, infrastructure and performance measurement.
QA professionals interested in developing these skills should focus on the following areas:
- Performance testing fundamentals: Understanding load, stress, spike, endurance and scalability testing.
- API testing: Understanding HTTP methods, status codes, headers, authentication and request-response structures.
- JavaScript fundamentals: Useful for creating and maintaining k6 scripts.
- Apache JMeter: Learning thread groups, samplers, timers, assertions, controllers and test data configuration.
- Grafana k6: Learning virtual users, scenarios, stages, checks, thresholds and test execution.
- Test data management: Creating representative data and managing dynamic values safely.
- Monitoring and analysis: Understanding response-time percentiles, throughput, error rates and infrastructure metrics.
- AI prompt engineering: Giving AI tools clear requirements, constraints and expected outputs.
- Problem-solving: Investigating performance degradation and validating potential bottlenecks.
Combining these skills helps testers move beyond simply executing scripts and develop a stronger understanding of application performance and reliability.
13. Learning Performance Testing and AI-Assisted QA in Toronto and the GTA
As organisations continue to develop web applications, APIs, cloud-based platforms and digital services, application performance remains an important part of software quality.
QA professionals in Toronto and across the Greater Toronto Area can benefit from developing practical knowledge of performance testing tools, API testing, automation scripting and AI-assisted test design.
Whether you are a new graduate, an aspiring QA tester or an experienced manual tester looking to expand into automation, understanding tools such as Apache JMeter and Grafana k6 can help broaden your technical capabilities.
At STEP IN 2 IT, we focus on practical IT training that helps learners develop skills relevant to modern software testing and QA workflows. Our training approach supports technical learning, hands-on practice and career preparation, with job placement assistance where applicable.
Training and job placement assistance do not guarantee employment. Career outcomes depend on individual skills, experience, employer requirements and market conditions.
Explore STEP IN 2 IT's software testing and QA training options to strengthen your understanding of modern testing practices and take the next step in your IT career development.
Frequently Asked Questions
What is AI-assisted performance testing?
AI-assisted performance testing uses artificial intelligence to support activities such as test script generation, workload design, script explanation, performance data analysis and test documentation. Testers remain responsible for validating the scripts, workloads and conclusions.
Can AI generate load testing scripts?
Yes. AI tools can generate draft scripts for technologies such as Grafana k6 and help design Apache JMeter test plans. The generated output must be reviewed and adapted to the application's actual endpoints, authentication, test data and performance requirements.
What is the difference between JMeter and k6?
Apache JMeter is an open-source testing tool with a graphical test-plan interface and support for several testing components. Grafana k6 is a developer-oriented performance testing tool that commonly uses JavaScript for scripting. Both can be used for performance and load testing, depending on project requirements and team preferences.
Does AI replace the need to learn performance testing?
No. AI can assist with repetitive scripting and analysis tasks, but testers still need to understand workload modelling, HTTP behaviour, performance metrics, test environments, monitoring and bottleneck investigation.
What is a virtual user in load testing?
A virtual user is a simulated user or execution unit that performs actions defined in a test script. The number of virtual users alone does not determine the exact number of real-world users a system can support. Workload design, request frequency, session behaviour and test execution model all matter.
What is a performance threshold?
A performance threshold is a defined acceptance condition for a metric, such as response time or request failure rate. It helps determine whether the application meets the performance objectives established for the test.
Can AI identify application performance bottlenecks?
AI can help analyse performance results and suggest possible bottleneck areas, such as database queries, application resources or network latency. These suggestions must be verified using monitoring data, logs, traces and further testing.
Is performance testing only required for large applications?
No. Applications of different sizes can experience performance problems. Even a small application may need performance testing if it supports important transactions, experiences variable traffic or has strict response-time expectations.
Conclusion
Performance and load testing are essential for understanding how applications behave under real-world and peak workloads. AI-assisted scripting is making parts of the process more accessible by helping QA professionals draft test scripts, explore workload patterns, understand unfamiliar code and analyse performance results.
However, effective performance testing still depends on sound test design, realistic workloads, validated scripts, meaningful thresholds and accurate interpretation of results.
For QA professionals, combining performance testing fundamentals with tools such as Apache JMeter and Grafana k6, along with practical AI prompting skills, can create a valuable foundation for modern software quality assurance.
AI may help accelerate the work, but the quality of the test still depends on the knowledge and judgement of the tester.