Good vs Bad Mission Prompting
Writing effective missions dramatically improves how well Testronaut's autonomous agents navigate your app. This page provides clear examples of good and bad prompting patterns to help you craft reliable, flexible tests.
🎯 Why Prompt Quality Matters
Testronaut agents reason step‑by‑step and adapt their actions based on the DOM. A well‑written mission:
- Keeps the goal clear
- Leaves implementation details flexible
- Mentions what you want validated, not how to click it
- Allows the agent to recover from unexpected UI conditions
- Encourages screenshot‑rich context (optional but very helpful)
A poorly written mission usually:
- Over‑specifies instructions
- Depends on CSS selectors, IDs, or exact wording
- Mixes multiple goals into one blob
- Describes internal implementation details instead of user‑level tasks
- Uses brittle assumptions that break easily
✅ Good Prompt Examples
1. Clear Goal, Flexible Steps
Good > "Log in as a returning user, navigate to the dashboard, and confirm that the monthly summary is visible."
Why it works:
- Defines an objective
- Doesn't force a specific interaction path
- Leaves room for UI variations
2. Explicit Validation Steps
Good > "After adding an item to the cart, confirm the cart counter updates and the item appears on the cart page."
Why it works:
- Tells the agent what to check
- Focuses on outcomes, not UI details
3. Contextual Notes Are Helpful
Good > "If a modal appears after login (e.g., an onboarding popup), close it and continue."
Why it works:
- Anticipates real‑world app behaviour
- Gives optional behaviours without blocking the core mission
4. Optional Screenshots for Guidance
Good > "At this point, include a screenshot showing the page where the invoice card should appear."
Why it works:
- Adds visual hints without dictating the flow
- Gives Testronaut an anchor for reasoning
❌ Bad Prompt Examples
1. Over-Specified Click Paths
Bad > "Click the 3rd button in the navbar, then click div#root > .container > form > input:nth-child(2)."
Problem:
- Breaks instantly if DOM layout changes
- Forces fragile interactions
- Human users wouldn't operate this way
2. Combining Multiple Missions Into One
Bad > "Log in, create a project, add tasks, invite a user, verify email delivery, and delete the project."
Problem:
- Too many unrelated goals
- Hard to interpret failures
- Should be separate missions or levels
3. Assuming the UI Always Behaves Perfectly
Bad > "After login you will always go straight to the dashboard."
Problem:
- Often untrue
- Leaves the agent stuck if modals/popups/toasts appear
4. Specifying Implementation Details
Bad > "Write the email into the field with ID #emailField-47."
Problem:
- IDs often vary
- Focus should stay at the UX level: "fill in the email field"
✨ Recommended Prompt Formula
Use this simple structure for dependable missions:
1. Goal
What the user is trying to accomplish.
2. Steps (High-Level Only)
Provide human‑level context, not CSS‑level steps.
3. Validations
What the agent should confirm or capture.
4. Edge Cases (Optional)
List any conditional UI states Testronaut should expect:
- modals
- warnings
- toasts
- redirects
5. Optional Screenshots
Attach 0--N screenshots to improve reasoning.
📘 Example Mission (Good)
Mission: Create a new project
Goal: Create a fresh project and verify it appears in the project list.
Steps:
- Log in using the test account.
- Navigate to the Projects section.
- Create a new project with the name “Agent Test Project”.
- Return to the project list.
Validations:
- The new project appears in the list.
- A success message is visible.
- Capture a final screenshot of the project list.
Edge Cases:
- If a tutorial modal appears, close it.
- If an existing project with the same name exists, delete it first.
🛠 Quick Troubleshooting for Prompt Issues
| Problem | Likely Cause | Fix |
|---|---|---|
| Agent gets stuck | Over‑specific instructions | Rewrite to focus on goals, not paths |
| Steps repeat | Conflicting instructions | Simplify the mission's objective |
| Agent clicks wrong | Screenshot mismatch or ambiguous | Add area prompt clarifying text or remove the screenshot |
| Mission fails on some UI | varies | Add optional screens flow notes |