Managing Secrets
Thunder Code uses Environments to manage secrets and credentials for your Test Cases.
Prerequisites
An existing Project
An existing Environment
Add Credentials (Secrets)
In the Environment form, click "Add Credentials"
Fill in the fields:
Credential Name
Secret Value (visible only to admins)
Description (optional)
Save your changes
Important: Credential names must follow these rules:
Can only contain uppercase letters, numbers, and underscores (_)
Maximum length of 32 characters
No spaces or special characters allowed
Secret values have a maximum length of 512 characters.
Using Credentials in Tests
Reference credentials in your Test Steps using [CREDENTIAL_NAME]. Thunder Code will automatically replace this with the actual secret during test execution. You can also reference credentials in the chat, and Thunder Code will automatically include them in any test steps it generates for you.
Example: Using Credentials in a Login Test
Let's say you want to test a login flow for your website. Instead of hardcoding sensitive information, you can store them as credentials in your environment:
1. Create Credentials in Your Environment
Create a credential named USER_EMAIL with your login email
Create a credential named PASSWORD with your login password
2. Reference These Credentials in Your Test Case
Create a new Test Case with the request:
Navigate to home page, enter [USER_EMAIL] in the email field, and [PASSWORD] in the password field. Finally, press the login button.
When Thunder Code executes this test, it will automatically replace [USER_EMAIL] and [PASSWORD] with the actual values from your selected environment. This way, you can:
Keep sensitive data secure
Easily switch between different test accounts by changing environments
π‘ Tip: You can add multiple credentials to a single Environment to organize your secrets effectively.
Important: If you want to run a test containing credentials on different environments, those credentials must be present in all environments. Otherwise, your tests will fail.