Skip to content

Variables & Secrets

How to use test variables and manage passwords securely in ZeniTest.

Use variables to reuse test values across your steps:

id: tc_search
title: Search Test
variables:
searchQuery: Wireless Headphones
userName: Alex
steps:
- navigate: /
- act: Type '${searchQuery}' into the Search bar
- act: Click 'Search'
- validate: Verify '${searchQuery}' results are displayed

Never write real passwords or sensitive API tokens directly into your test files. Instead, use secret placeholders:

steps:
- navigate: /login
- act: Type 'admin@example.com' into 'Email'
- act: Type '${secret.ADMIN_PASSWORD}' into 'Password'
- act: Click 'Sign In'

Create a file named secrets.yaml in your project root (and add it to .gitignore):

secrets:
ADMIN_PASSWORD: superSecretPassword123
PAYMENT_TOKEN: tok_test_12345

You can also use a flat format without the secrets: wrapper — both work the same way:

ADMIN_PASSWORD: superSecretPassword123
PAYMENT_TOKEN: tok_test_12345

ZeniTest also recognizes credentials.yaml as an alternative name. Both .yaml and .yml extensions are supported.

The CLI searches for secrets files in this order:

  1. Inside your test directory (e.g. zenitests/secrets.yaml)
  2. In your project root (e.g. ./secrets.yaml or ./credentials.yaml)
  3. In your home folder at ~/.zenitest/secrets.yaml

If secrets are found in multiple locations, they are merged together. This means you can keep shared secrets in ~/.zenitest/ and project-specific ones in your project root.

ZeniTest automatically substitutes ${secret.ADMIN_PASSWORD} at runtime without exposing the value in test files or logs.