1. Docs
  2. Use cases
  3. Use cases
  4. How do I get a load test from my functional tests?

How do I get a load test from my functional tests?

In SmartestQA, AI generates a JMeter plan or a k6 script from the API steps of a test case: in Automate click More, then JMeter and Generate JMX, or k6 and Generate k6 script, and describe the load in words. The result is saved as a new load-test case that runs in a pipeline in Schedule, and Report shows requests, errors, P90, throughput and a comparison with the previous run.

11 min read Updated CustomersAdmins

In short

On this page you can

  • Generate a JMeter plan or a k6 script from existing API steps.
  • Describe users, ramp-up and think time in plain words.
  • Upload an existing .jmx file or k6 .js script instead.
  • Set the load values per pipeline.
  • Read the verdict, P90, errors and the comparison with the previous run.

How to use it

  1. Open a test case with saved API steps in Automate.
  2. Click More › JMeter › Generate JMX, or k6 › Generate k6 script.
  3. Write the load prompt, review the plan and click Generate.
  4. Click Save as JMeter or Save as k6 test.
  5. Add the new test case to a pipeline, set the load settings and run it.

The short answer#

A load test in SmartestQA is built from API steps. If your functional test already has them, open it in Automate, click More › JMeter › Generate JMX or k6 › Generate k6 script, and describe the load. AI builds the plan from the API steps in their order, including the values they save and reuse, for example a login token used by the next requests. The result is saved as a new test case; the source case stays as it is.

If your functional test is a web UI test, first turn its captured calls into an API test case, then generate the load test from that. A load test needs its own test case: it takes only JMeter, k6 and API steps.

The problem this solves#

In many teams functional tests and load tests are two separate worlds. The functional tests know the journey: log in, create something, read it back. The load test is built again from nothing, in another tool or as a script, often by a different person, and it has to repeat the same requests and the same handling of the login token.

Because that second build is extra work, the load test is often written late, shortly before a release, and then left alone. When the API changes, the functional tests are updated and the load test is not. And the results sit in files on someone’s machine, so comparing today’s run with the last one is manual work.

An example#

This is an illustration, not a customer story. A team builds a delivery app and has a test case “Place order” with three API steps: log in, create an order, read its status.

  1. A tester opens the test case in Automate and clicks More › JMeter › Generate JMX. The dialog shows how many API requests it will use.
  2. The tester writes the prompt: “100 users, 30s ramp-up, repeat each request 5 times, 1s think-time between requests, add an assertion for HTTP 200.” The plan appears under Test plan (you can edit it). The tester reads it and clicks Generate.
  3. After a look at the Code and Design tabs the tester clicks Save as JMeter. A new test case “Place order - JMeter” is created in the same folder. The source test case stays as it is.
  4. The tester adds the new test case to a pipeline in Schedule, sets the load values on the tab JMeter Settings and runs it on a machine where JMeter is installed.
  5. During the run a live panel refreshes about every 5 seconds. The step ends as failed with “12 of 480 requests failed (2.5%). Top error: …”.
  6. A developer fixes the cause and the pipeline runs again. This time no request fails, and vs previous run shows P90 and error rate against the run before.

The load test came from the functional test the team already had, and its result can be read next to the previous run.

With a script, with a separate tool, and with SmartestQA#

QuestionA load script written by handA separate load test toolSmartestQA
Where does the scenario come from?Written from nothing, repeating the requests of the functional testsRecorded or built again in that toolAI builds it from the API steps of a test case, in their order, with the values they save and reuse
How do you set the load?In the codeIn the tool’s settingsIn words in the prompt; the pipeline’s load settings (users, ramp-up, duration, loops, think time) are passed to the plan
Can you use a file you already have?It is the fileOften, by importYes: Upload JMX or Upload script
Where does it run?On a machine or CI runner you prepareOn the tool’s load generatorsOn the machine that runs the test. JMeter must be installed there; k6 is downloaded automatically when missing
When does the test fail?When the thresholds you coded are missedBy the rules you configureWhen at least one request failed; for k6 also when the script’s thresholds fail
How do you compare with the last run?Keep the result files and compare them yourselfIn the tool’s history, if it keeps oneThe report shows P90 and error rate against the step’s previous run

Steps#

  1. Start from API steps

    Open a test case whose API steps cover the journey to load-test, and save it. Without API steps the dialog shows “No API requests to test yet”. For a web UI test, make the API test case first; see How do I turn a UI test into API tests?

  2. Open Generate

    Click More › JMeter › Generate JMX, or More › k6 › Generate k6 script. The dialog shows how many API requests it will use.

  3. Describe the load

    Write what you want, for example: “100 users, 30s ramp-up, repeat each request 5 times, 1s think-time between requests, add an assertion for HTTP 200.” A prompt is required (“Please enter a prompt.”).

  4. Review the plan

    The dialog prepares a plan in words under Test plan (you can edit it). Edit it or click Regenerate plan. Then click Generate.

  5. Check and refine

    The result opens with a Code tab and a Design tab. Use Refine with prompt for changes; the AI’s changes are highlighted and can be undone.

  6. Save as a new test case

    Click Save as JMeter or Save as k6 test. See Generate with AI from API steps.

    A new test case named after the source with “ - JMeter” or “ - k6” is created in the same folder, with the load-test step in it.

  7. Run it in a pipeline

    Add the new test case to a pipeline in Schedule. A pipeline with a load-test step shows the tab JMeter Settings, k6 Settings or Load Test Settings with the per-pipeline load values: users, ramp-up, duration, loops and think time. They are passed to the plan. See Mobile, desktop and load tests.

  8. Read the report

    While the test runs, a live panel refreshes about every 5 seconds. When it ends, the Summary of a pipeline whose test cases are all load tests shows the load verdict and the Load steps table, and each step has its own report with Summary & charts and Requests / Responses. See Load test results.

JMeter and k6 side by side#

JMeterk6
Generate from API stepsGenerate JMX, then Save as JMeterGenerate k6 script, then Save as k6 test
Upload an existing fileUpload JMX: a .jmx fileUpload script: a .js script that contains export default function
On the machine that runs the testJMeter must be installed therek6 is downloaded automatically when missing
Pipeline load settingsPassed to the planUsed only if the script reads them; otherwise the load settings are fixed in the script
Dry RunUses the values in the JMXRuns with 1 user and 1 iteration
Passes whenNo request failedNo request failed and the script’s thresholds hold
View and editJMX (XML) with Edit, Edit with AI and Download .jmx; the Design tab shows the Test Plan (Design)k6 script (JavaScript) with edit, refine and Download .js; the design shows the scenario and each request
ResultsAn HTML report; Download JTL for the raw resultsDownload results: the raw samples as a JTL-format CSV

Both step types exist in WEB and DESKTOP projects, not in mobile projects. See Load test steps: JMeter and k6.

What the load report tells you#

ColumnMeaning
RequestsRequests sent during the step.
Errors“Requests that failed (no answer, 4xx/5xx, failed assertion). Slow answers are SLA misses, not errors.”
P90“9 of 10 requests were answered within this time.” Amber when requests missed their target.
ThroughputRequests answered per second over the whole step.
Peak usersMost virtual users active at the same time.
DurationHow long the step ran.
vs previous runP90 and error rate against the step’s previous run, or first run.

The step’s own report adds a verdict strip (Passed, Passed with warnings or Failed with its reasons), an Assessment, and Compared with a previous run for Avg response, P90, P99, Throughput, Error rate, Apdex, Requests and Peak users. See A load step’s report.

What you get#

  • A plan from your API steps. The plan comes from the API steps you already have, in their order, with the saved values they pass on.
  • An editable file. The JMX or the k6 script can be edited, refined with a prompt and downloaded.
  • A strict pass rule. One failed request is enough to fail the step. Example from the docs: 480 requests, 12 failed, 12 ÷ 480 × 100 = 2.5 %, and the message names the most frequent error.
  • Live numbers. A live panel refreshes about every 5 seconds until the final report arrives.
  • A comparison with the last run. Each value is marked Better, Worse or Similar; if the load differs the report warns “compare with care”.
  • Safety limits. The platform administrator sets a time limit, 1 hour unless changed, and a maximum number of users. A plan above the user limit does not start; a test that hits the time limit is stopped and reports its partial results.

Questions and answers#

Can I add a load-test step to my UI test case?Customers

No. In SmartestQA a test case with a JMeter or k6 step takes only JMeter, k6 and API steps, and a test case with browser, mobile or desktop steps takes no load-test step. Put the load test in a test case of its own. See A load test needs its own test case.

My functional tests are UI tests. Can I still get a load test from them?Customers

Yes, for web tests, in two steps. Make an API test from the captured network calls in Maintenance, then generate a JMeter test from that test case in Automate. See Make an API test, step by step.

Can I use a JMeter or k6 file I already have?Customers

Yes. In Automate click More › JMeter › Upload JMX or k6 › Upload script and pick the file; it becomes one step. A k6 file must contain export default function. See Upload a file.

Do I need to install JMeter or k6?Customers

The load test runs on the machine that runs the test. JMeter must be installed there; k6 is downloaded automatically when it is missing. See “JMeter could not be found on this machine”.

When does a load test fail?Customers

When at least one request failed, with a message such as “12 of 480 requests failed (2.5%). Top error: …”. For k6, failed thresholds of the script fail it too. The report stores a failed load step as ERROR. See At run time.

How many users and how long can a load test run?Customers

The platform administrator sets a time limit, 1 hour unless changed, and a maximum number of users. A plan above the user limit does not start, and a test that hits the time limit is stopped and reports its partial results. See Time limit or user limit reached.

What does a Dry Run do with a load test?Customers

A Dry Run has no pipeline settings. JMeter uses the values in the JMX; k6 runs with 1 user and 1 iteration. For the real load, run the test case in a pipeline with its load settings. See Dry Run.

Can I stop a running load test?Customers

Yes. Stopping the pipeline run stops the load test, and completed requests are still reported. A JMeter step stops within seconds and keeps its partial results. See Stop a run.

Can I get the raw results or a PDF?Customers

Yes. Download JTL saves the step’s raw results; k6 samples come as a JTL-format CSV. The JMeter section of the report PDF follows the view you have open, so choose it before you click Export PDF. See Load tests in the PDF and email.

Can an AI agent prepare or run the load tests for me?Customers

Two agents of the catalog cover this, both started with Run now. API & load tests captures the scenarios’ browser traffic and drafts an API test case and a JMeter test per page for the API and Performance pipelines; it does not run load tests. Performance before / after runs the JMeter tests of the Performance pipeline, compares them with the previous measurement and warns on a regression. See The catalog: On demand.

Read more#

Didn’t find your answer?Write to support with your project name and what you see on screen.

info@smartestqa.ai