Supercheck LogoSupercheck

Variables

Store configuration, secrets, and data files securelyEdit

Variables give your tests configuration, credentials and test data at runtime.

Variables List

Use file variables for non-sensitive test data and fixtures. Keep passwords, API keys, and tokens in Secrets, not inside uploaded files.

Variables vs Secrets vs Files

ChooseUse forRead in a testVisibility
VariableURLs, timeouts, configurationgetVariable('KEY')Plain text in the dashboard and output.
SecretPasswords, API keys, tokensgetSecret('KEY')Encrypted at rest; revealing requires permission. Avoid logging it.
FileCSV, JSON, YAML, XML, TSV, or text fixtures up to 5 MBPlaywright: readFile('KEY'); k6: open(getFile('KEY')) during initUploaded test data; do not include credentials.

Creating Variables

Open your project's Variables page and select Add Variable.

Choose the Type, then enter a Variable Name and its value.

TypeKey exampleValue
Variable (default)BASE_URLPlain text, e.g. https://staging.example.com
SecretAPI_KEYText, encrypted and masked
FileTEST_DATAUpload CSV, JSON, YAML, XML, TSV or plain text, max 5 MB

Optionally add a description for your team, then select Add Variable.

Add Variable dialog with Type set to Variable

Add Variable dialog with Type set to Secret and a masked value

Secret values are masked in the UI. Users with secret-view permission can reveal a value with the audited reveal action (refused while a super admin is impersonating a user). Converting a secret back to a variable requires a replacement value.

Using Variables in Tests

Access variables and secrets in your test code using the built-in functions:

Use for non-sensitive configuration:


// Basic usage
const baseUrl = getVariable('BASE_URL');
const timeout = getVariable('TIMEOUT');

// Navigate using variable
await page.goto(baseUrl + '/login');

readFile() is for Playwright and other Node.js-based execution. k6 does not support readFile(). For k6, always use open(getFile('KEY')) during init context.

Secret Protection

Use getSecret() when a test needs a credential. Execution output masks secret values, but you should still avoid logging them:


// Avoid intentional secret logging in scripts
// Worker redaction is an additional protection layer for accidental output
console.log('API key configured:', !!getSecret('API_KEY'));

const actualKey = getSecret('API_KEY');

Masking covers console output, error messages, and text report files (.html, .json, .txt, .md, .xml, up to 20 MB each). It does not cover traces, screenshots, videos, or the Playwright HTML report, whose test data is stored compressed inside the page. If a test types a secret into a page, the secret can appear in those artifacts. Do not type secrets into pages whose reports you share.

Secrets work normally in:

  • Playwright actions (page.fill(), page.click())
  • HTTP headers and request bodies
  • URL parameters
  • Comparisons and conditionals

Common Patterns

const env = getVariable('ENVIRONMENT'); // 'staging' or 'production'
const baseUrl = getVariable(`${env.toUpperCase()}_URL`);

await page.goto(baseUrl);

Best Practices

Security Features

Store credentials as Secrets to encrypt saved values. Editing a secret starts with an empty value field; leave it blank to keep the current value, or select Reveal current value to view it. Keep secrets out of uploaded data files.

On this page