Test Design
Keep tests focused and atomic
Keep tests focused and atomic
Each test should validate one specific user journey or feature.Good:
- “User can add item to cart”
- “Admin can create new user account”
- “Password reset flow works”
- “Test entire checkout including login, browsing, cart, payment, and confirmation”
- “Test all admin features”
Use descriptive test names
Use descriptive test names
Names should clearly describe what’s being tested and the expected outcome.Pattern:
[Actor] can [action] [expected result]Examples:- “Guest user can view product details without login”
- “Admin can delete user and see confirmation”
- “Cart preserves items after logout and login”
Test Organization
Organize by feature or user journey
Organize by feature or user journey
Group related tests into logical suites.By feature:
- “User Authentication”
- “Shopping Cart”
- “Checkout & Payment”
- “User Profile”
- “New User Onboarding”
- “Purchase Flow”
- “Account Management”
- “Critical Smoke Tests”
- “Full Regression”
- “Edge Cases”
Use consistent naming conventions
Use consistent naming conventions
Establish naming patterns across your test library.Suites:
[Feature/Area] Tests- “Authentication Tests”
- “Checkout Tests”
[Actor] can [action]- “User can login with valid credentials”
- “Admin can view all users”
[Role] - [Environment]- “Admin - Staging”
- “Customer - Production”
Separate critical paths from comprehensive coverage
Separate critical paths from comprehensive coverage
Not all tests are equally important.Critical suite: (run every commit/deploy)
- Login/logout
- Core user journeys
- Revenue-generating flows
- 5-10 tests, < 5 minutes total
- All features
- Edge cases
- Integration tests
- 50-200 tests, 30-60 minutes total
Browser Profiles
Create role-specific profiles
Create role-specific profiles
Maintain separate profiles for each user role.Setup:
- Admin profile (full permissions)
- Manager profile (limited admin)
- Standard user profile
- Guest/unauthenticated profile
- Premium/paid user profile
- Free tier profile
- Test permission boundaries
- Verify role-specific features
- Ensure proper access control
Keep profiles fresh
Keep profiles fresh
Sessions expire - maintain profiles proactively.Schedule:
- Weekly: Critical test profiles
- Monthly: Less frequently used profiles
- After changes: Password updates, auth changes
Use test accounts, not real users
Use test accounts, not real users
Never use real customer or employee accounts.Create dedicated test accounts:
- Separate from production users
- Clearly labeled as test accounts
- Document credentials securely
- Rotate passwords periodically
Using AI Features
Use the Swarm for initial coverage
Use the Swarm for initial coverage
Let AI bootstrap your test suite, then refine.Workflow:
- Run the Swarm with focused area
- Review all proposed tests
- Accept high-value tests
- Edit tests that need adjustment
- Reject low-value tests
- Supplement with manual tests for critical paths
Provide context to the Swarm
Provide context to the Swarm
Better guidance = better tests.Include:
- Detailed focus area descriptions
- Clear guidelines (what to avoid)
- Documentation URLs
- Feature descriptions
“Focus on the checkout flow including cart management, address entry, payment selection, and order confirmation. Don’t test admin features or account deletion.”
Review AI-generated tests critically
Review AI-generated tests critically
AI is powerful but not perfect.Evaluate each test:
- Does it test important behavior?
- Are steps logical and complete?
- Are assertions meaningful?
- Is it redundant with other tests?
Maintenance
Fix broken tests immediately
Fix broken tests immediately
Don’t let test debt accumulate.When a test fails:
- Investigate within 24 hours
- Fix if it’s a legitimate failure
- Update if application changed
- Disable temporarily if can’t fix immediately
- Document why disabled
Review and prune regularly
Review and prune regularly
Test suites need periodic maintenance.Monthly review:
- Delete redundant tests
- Update outdated tests
- Remove tests for deprecated features
- Consolidate overlapping tests
Update after major changes
Update after major changes
Application updates may require test updates.After:
- UI redesigns
- Feature changes
- Authentication updates
- URL structure changes
- Review affected tests
- Update selectors
- Adjust assertions
- Verify all tests pass
Performance
Keep tests fast
Keep tests fast
Faster tests = faster feedback = better productivity.Optimize:
- Remove unnecessary waits
- Use appropriate timeouts
- Skip non-critical assertions
- Avoid testing same setup repeatedly
Run tests in parallel
Run tests in parallel
Suite runs execute tests in parallel for speed.Benefits:
- Faster results
- Better resource utilization
- More frequent testing possible
Use browser profiles to skip authentication
Use browser profiles to skip authentication
Don’t log in for every test.Instead of:
Every test starting with login flow (+ 30-60 seconds each)Do:
Create authenticated profile once, reuse across all testsSavings: Hours per week with large test suites
Documentation
Document test assumptions
Document test assumptions
Help future you (and teammates) understand tests.Document:
- What the test validates
- Prerequisites (data, state)
- Known limitations
- Why specific assertions exist
Track test ownership
Track test ownership
Know who to ask about specific tests.Assign:
- Suite owners
- Test creators
- Feature experts
Team Practices
Make testing a team responsibility
Make testing a team responsibility
Everyone contributes to test coverage.Pattern:
- Developers add tests for new features
- QA creates comprehensive suites
- Product reviews test coverage
- Everyone fixes broken tests
Review tests like code
Review tests like code
Apply code review practices to tests.Review for:
- Clear test names
- Appropriate assertions
- Proper organization
- No redundancy
- Good coverage
Celebrate test coverage wins
Celebrate test coverage wins
Positive reinforcement builds testing culture.Recognize:
- Catching bugs before production
- Reaching coverage milestones
- Creating especially valuable tests
- Reducing flaky tests