Keep tests in git
A test file describes one performance test as code. You commit it next to the script it runs, review changes in pull requests, and let CI sync it to MaxoPerf. This page shows the file layout, the sync rules and the case where console edits get overwritten.
Lay out the repository
Section titled “Lay out the repository”.maxoperf/ tests/ checkout.ymlperf/ checkout/ script.js users.csvEvery *.yml or *.yaml file in .maxoperf/tests/ is one test. Paths inside the file (entrypoint, assets) are relative to the repository root.
Write the test file
Section titled “Write the test file”-
Create
.maxoperf/tests/checkout.yml:version: 1name: "Checkout soak" # the key: unique per projectprojectId: "prj-0123456789" # optional if the project is passed another wayengineKind: "k6"entrypoint: "perf/checkout/script.js"assets: ["perf/checkout/users.csv"]loadProfile: { virtualUsers: 50, agentCount: 1, rampUpSeconds: 30, durationSeconds: 300 }locationPlan: { managedRegions: ["us-east-1"] } # or privateDatacenterId: "pdc-..."failureCriteria:- { subject: "p95", condition: ">", threshold: 800, unit: "ms" }- { subject: "fail", condition: ">", threshold: 0 }tags: ["smoke", "checkout"]config: ["TARGET_URL"] # workspace config values to bind, by keysecrets: ["CHECKOUT_API_TOKEN"] # workspace secrets to bind, by key -
Create the workspace config value
TARGET_URLand the secretCHECKOUT_API_TOKENin the console first. A listed key that does not exist fails the sync and the error names the key. See Manage test secrets. -
Run the action with
command: pushto sync without running:- uses: MaxoPerf/github-action@v1with:api-key: ${{ secrets.MAXOPERF_API_KEY }}account-id: ${{ vars.MAXOPERF_ACCOUNT_ID }}command: pushFrom a terminal the equivalent is
npx @maxoperf/cli push.
Fields
Section titled “Fields”| Field | Required | Meaning |
|---|---|---|
version | yes | Always 1. |
name | yes | The test’s identity. Sync finds the test by exact name within the project. |
projectId | no | Project the test lives in. |
engineKind | yes | The engine that runs the script, for example k6 or jmeter. |
entrypoint | yes | Path of the main script, relative to the repository root. |
assets | no | Extra files uploaded with the test, such as CSV data. |
loadProfile | yes | Virtual users, runner count, ramp-up and duration. |
locationPlan or privateDatacenterId | one of them | Where the test runs. |
failureCriteria | no | Conditions that fail a run. Each needs subject, condition (>, <, >=, <=, =, ==) and a numeric threshold. |
tags | no | Tags on the test. Deploy hooks select tests by tag. |
config | no | Names of workspace config values to bind. |
secrets | no | Names of workspace secrets to bind. |
An unknown key makes the file fail with a message naming the key, and nothing is sent for that file. Only plain, upload-mode, single performance tests fit the format. Browser settings, runner sizes and other console-only settings are not part of it.
The project comes from the first of: the project-id input or --project flag, the file’s projectId, then the MAXOPERF_PROJECT_ID environment variable. If none is set, the file fails.
What sync does
Section titled “What sync does”For each file, sync does the following in order:
- Finds the test by
namein the project, or creates it. - Replaces the bindings with exactly the
configandsecretskeys you list. - Uploads every file whose content hash changed and deletes test files that are no longer listed.
- Writes the full configuration from the YAML and marks the test as managed from git.
A second sync of an unchanged repository uploads nothing and creates nothing.
Avoid duplicate tests in a matrix
Section titled “Avoid duplicate tests in a matrix”If a matrix of jobs syncs a test that does not exist yet, two jobs can both create it. Sync once in an earlier job, then fan out:
jobs: sync: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: MaxoPerf/github-action@v1 with: api-key: ${{ secrets.MAXOPERF_API_KEY }} account-id: ${{ vars.MAXOPERF_ACCOUNT_ID }} command: push load-test: needs: sync strategy: matrix: test: [checkout, search] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: MaxoPerf/github-action@v1 with: api-key: ${{ secrets.MAXOPERF_API_KEY }} account-id: ${{ vars.MAXOPERF_ACCOUNT_ID }} tests: .maxoperf/tests/${{ matrix.test }}.ymlIf duplicates already exist, every later sync fails that file and names both test ids, so it is never silent. Do not start runs of a test while a push of the same test is still running.
Next steps
Section titled “Next steps”- Gate pull requests with these tests.
- Start from an existing console test with Export a console test to git.
- The same files work with the CLI.