Menu
Documentationbreadcrumb arrow Componentsbreadcrumb arrow Test Validator
Open source

Test Validator

The Test Validator can help you validate that a test script is working as expected. You can use it to run one iteration of your test, and visualize the request and response of any requests on your test script, as well as checks and logs. The Test Validator works with any k6 test script, not only scripts generated in k6 Studio.

k6 Studio Test Validator window, showing a test script that has been executed, with a list of requests and their status code, as well as the request and response panels on the right, and the script preview

The Test Validator window is composed of:

  1. Test script name: The name of the test script.
  2. Test Validator actions: On the top-right you can see the action buttons for the Test Validator. From here you can click Validate script to run one iteration of your test script, or click the menu icon to:
    • Open external script: Open a k6 test script from your computer. After opening it, click Validate script to run one iteration of the test.
    • Delete: Deletes the selected test script.
  3. Test Validator options: Below the test recording name, you can see:
    • Requests: The total number of requests in the recording
    • Filter: A search box that lets you filter the list of requests by URL, method (such as GET or POST), and status code.
  4. Requests and groups list: The list of requests, and groups if any, that were executed in the test run. The requests are organized by time, and you can see the method, status code, host, and path for each one. You can also collapse and expand groups to inspect them more easily.
  5. Request, response, script, and rule inspector: When you click on a request from the requests list, a panel opens on the right side which shows the request and response details for that request. You can use it to inspect the headers, payload, cookies, and content of the requests.
  6. Logs, checks, and script inspector: Any logs or checks generated by test run can be found on their respective tabs. You can also visualize the script that was executed here, to help you debug the behavior from the test run results.

Validate a test

There are two ways to validate a test:

  • Use the Test Generator component:
    1. Open a test generator
    2. Click the menu icon on the top-right, and select Validate script.
  • Use the Scripts component:
    1. Open a script
    2. Click Validate script on the top-right.

After you click Validate script, k6 Studio runs one iteration of the test script and shows you the results of the test as the script is executed.

Inspect test results

During a test script run, and once it’s completed, you can inspect the test results. Similar to the Test Recording component, you can click on any requests from the Requests list to view the request and response data, including the header, payload, and cookies.

You can also view any logs and checks generated by the test run in the Logs and Checks tabs to help you debug your test script.

Validate external script

You can use the Test Validator to validate scripts that are created outside k6 Studio as well:

  1. From the k6 Studio homepage, click Validate script.
  2. Click Open external script.

Alternatively, from the Test Validator screen you can:

  1. Click the menu options icon on the top-right.
  2. Click Open external script.

You can then select a script located outside of k6 Studio, and then click Validate script to execute one iteration of the test.

If you want to view the script under the Scripts section of the k6 Studio application, you can:

  1. Open the k6-studio Scripts folder.
    • For macOS, that can be found in ~/Documents/k6-studio/Scripts.
    • For Windows, that can be found in C:\Users\<USERNAME>\Documents\k6-studio.
    • If you have a script in k6 Studio already, you can right-click on it and click Open containing folder.
  2. Copy your script to the Scripts folder.

After that, you should be able to see your test script in k6 Studio under Scripts.