Introduction
This guide covers best practices for writing test case steps that Thunders AI can execute reliably.
Well-written steps describe what a real user sees and does on screen with clear actions, visible UI labels, and verifiable expected results. Following these practices helps you avoid flaky tests, reduce ambiguity, and get the most out of AI-powered step generation.
1️⃣ Always write as a real user.
❌ Trigger the onSubmit function
❌ Validate the form
These describe what the code does, not what a user does on screen. AI needs visible, human actions to execute a step, not technical implementation details.
Use:
✓ Click the "Log in" button
2️⃣ Each step should describe one single action.
❌ Click the Log in button, fill the Email field with "[email protected]", and verify the error message appears
This combines two actions and a verification in one step. If any part fails, it's impossible to know which one caused it, and AI may only execute part of it.
Use:
✓ Click the Log in button
✓ Enter "[email protected]" in the Email field
✓ Verify the error message is displayed (as a separate expected result)
3️⃣ One sentence = one observable action.
❌ Authenticate myself
❌ Complete the form
These describe intentions, not visible actions. If you can't physically see or do it on screen, it's too abstract for AI to act on.
Use:
✓ Enter "[email protected]" in the Email field
4️⃣ Always name elements as they appear on the screen.
❌ Click the main button
❌ Click the icon
❌ Fill in Field 1
Generic references give AI nothing to anchor to, it will guess, and likely get it wrong. Always use the exact label visible in the UI. When there's no text label, describe the color, icon, or position.
Use:
✓ Click the "Log in" button
✓ Click the pencil icon next to the user's name
✓ Click the blue "Save" button in the top right corner
5️⃣ Use consistent vocabulary
Choose one verb per type of action and try to maintain consistency for your test cases:
💡 Consistency = better tests generated.
Action | Recommended verb |
Navigation |
|
Click |
|
Enter |
|
Visibility |
|
Assertion |
|
6️⃣ Describe the intention, not the implementation
❌ Enter an invalid value on the backend
This references system internals a user cannot see or interact with. Steps must stay within the user's perspectiven what they type, click, or observe.
Use:
✓ Enter an incorrect password in the Password field
7️⃣ Include important intermediate states
❌ Create an account for the new user
This skips all observable steps, navigating to the registration page, filling each field, submitting the form, and verifying the confirmation message. AI cannot automate what it cannot see.
Use:
✓ Navigate to the registration page
✓ Enter "John" in the First Name field
✓ Enter "[email protected]" in the Email field
✓ Click the Create Account button
✓ Verify the confirmation message is displayed
8️⃣ Anticipate negative cases when writing.
❌ Only writing the happy path: Enter valid credentials and click Log in
Testing only what should work leaves large gaps in coverage. AI handles negative cases just as well as positive ones, but only if you write them.
Use:
✓ Click the Log in button without filling in any fields
✓ Enter an invalid email address in the Email field
✓ Click the Submit button twice in quick succession
9️⃣ If AI cannot automate it, rephrase it.
❌ Understand that the error is clear
❌ The page looks correct
These require human judgment and interpretation, there is nothing concrete to verify. A step is testable only if it describes something visible, measurable, or present on screen.
Use:
✓ An error message "Invalid credentials" is displayed below the Email field
✓ The dashboard page is displayed with the user's name in the top right corner
Complete example, putting it all together
This example applies all nine rules in a single test case. Use it as a reference when writing your own.
✓ 1. Navigate to the login page
✓ 2. Enter "[email protected]" in the Email field
✓ 3. Enter "password123" in the Password field
✓ 4. Click the Log in button
✓ 5. Verify the dashboard page is displayed
✓ 6. Verify the username "John Doe" is visible in the top right corner
Why this works:
Each action is observable and performed by a real user
UI labels match exactly what appears on screen
No technical references or vague language
Expected results use "Verify" and are placed directly after the action that triggers them
Every step is executable by someone with no prior context
Before / After — common mistakes
❌
1. Scroll to the page
2. Submit
3. See an error
Nothing here is actionable without clear context. "The page", and "an error"… give AI no reliable element to target.
Steps 1–3 are actions but step 4 is an expected result that hasn't been written as one.
✓
1. Navigate to the login page
2. Enter "[email protected]" in the Email field
3. Enter "wrongPassword" in the Password field
4. Click the Log in button
5. Verify an error message "Invalid credentials" is displayed
6. Verify the login page remains displayed
Mixing actions, verifications and technical references
❌
1. Click the primary button to submit the form
2. The backend returns an error
3. The message is correctly displayed
"Primary button" is not a visible UI label. "The backend returns an error" is an implementation detail, not a user observation. "The message is correctly displayed" is not verifiable as written.
✓
1. Click the Log in button
2. Verify an error message "Invalid credentials" is displayed
3. Verify the home page is not displayed
Too abstract
❌
1. Authenticate with invalid credentials
This describes an intention in a single step, skipping every observable action in between. AI cannot infer what fields exist, what values to enter, or what to verify.
✓
1. Enter an invalid email address in the Email field
2. Enter an incorrect password in the Password field
3. Click the Log in button 4. Verify an error message is displayed
Golden rule to remember
If you can't hand a test step to a new colleague and have them execute it manually from its description alone AI might struggle too.
