Managing Secrets
Thunder Code uses Environments to manage Variables and Credentials for your Test Cases.
Prerequisites
An existing Project
An existing Environment
Add Credentials (Secrets)
Scroll Down to the Environment Variables Section.
Click on “Add Credentials”.
Fill in the fields:
Credential Key.
Value (Visible only to admins).
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 variable 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
📝 Note: To keep them secure, the replacement of credentials will not be displayed during the Test Case Execution or in Test Report.
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.