Skip to main content

Flow Design Best Practices

Well-designed test flows are easier to maintain, more reliable, and provide better coverage. This guide covers proven patterns for creating effective flows in Rock Smith.

Flow Architecture Principles

Single Responsibility Flows

Each flow should test one user journey or scenario. This makes flows easier to understand, debug, and maintain.

Recommended flow length: 5-15 steps

Flow SizeUse CaseMaintainability
1-4 stepsQuick smoke testsHigh
5-15 stepsStandard user journeysOptimal
16-25 stepsComplex multi-page workflowsModerate
25+ stepsConsider splittingLow
tip

If a flow exceeds 15 steps, consider whether it tests multiple user journeys that should be separate flows.

Good examples:

  • "Login with valid credentials"
  • "Add item to shopping cart"
  • "Submit contact form"

Avoid:

  • "Login and checkout and update profile" (combines three journeys)
  • "Full user workflow" (too vague and likely too long)

Flow Naming Conventions

Use descriptive, action-oriented names that explain what the flow tests:

PatternExampleWhy It Works
Action + Context"Login with valid credentials"Clear what's being tested
Feature + Scenario"Checkout as guest user"Specifies the variation
User Journey"Complete password reset"Describes the full path

Avoid:

  • "Test 1", "Flow A" (meaningless)
  • "Login" (too generic—which login scenario?)
  • "New flow 2024-01-15" (dates don't describe behavior)

Flow Organization

Organize flows using Rock Smith's project structure:

Project-based grouping:

  • Group related flows by feature area or product
  • Use projects like "Authentication", "Checkout", "User Profile"
  • Keep discovery sessions and flows together in the same project

Flow hierarchy:

  • Baseline flows (depth 0): Core happy-path scenarios
  • Edge case flows (depth 1+): Variations generated through fuzzing
  • Use the Flow Map navigator to visualize and navigate your flow tree

Flow status lifecycle:

  • Draft: Flow under development, not ready for regular execution
  • Review: Flow complete, awaiting team review
  • Approved: Production-ready, included in test suites

Semantic Element Targeting Best Practices

Rock Smith uses semantic targeting—describing elements as users see them—instead of brittle CSS selectors. This makes tests resilient to UI changes.

Writing Effective Element Descriptions

Describe elements using visual characteristics that won't change when implementation details shift:

Visual CueExample Description
Color"The blue Submit button"
Position"The search icon in the top-right corner"
Icon"The gear icon for settings"
Text"The button labeled 'Sign In'"
Context"The email input below the welcome message"

Good targeting descriptions:

✓ "The blue Submit button at the bottom of the form"
✓ "The email input field with placeholder 'Enter your email'"
✓ "The red Delete icon next to the file name"
✓ "The dropdown menu labeled 'Country'"

Avoid:

✗ "The button with class btn-primary" (implementation detail)
✗ "The third input on the page" (fragile to layout changes)
✗ "Submit" (too vague if multiple submit buttons exist)
✗ "#email-field" (CSS selector, will break)

Using Visual Context Fields

Rock Smith provides four targeting fields. Use them together for precise element identification:

FieldWhen to UseExample
LabelPrimary identification"Submit button", "Email input"
PositionDisambiguate similar elements"top-right", "below the form"
TextWhen visible text is distinctive"Sign In", "Learn More"
TypeClarify element category"button", "input", "link", "dropdown"

Combining fields for precision:

Label:    "Submit button"
Position: "bottom of the login form"
Text: "Sign In"
Type: "button"

This combination uniquely identifies the element even if multiple buttons exist on the page.

Self-Healing Test Patterns

Semantic targeting enables self-healing—tests automatically adapt when UI changes. Design for this:

Do:

  • Describe what users see, not implementation
  • Use multiple visual cues for critical elements
  • Reference stable text content (labels, headings)

Don't:

  • Reference dynamic IDs or generated class names
  • Depend on exact pixel positions
  • Assume specific DOM structure
note

When a UI redesign moves a button but keeps its label and function, semantic targeting still finds it. Selector-based tests would fail.

Action Configuration Best Practices

ActionBest Practice
navigateUse for direct URL access; set appropriate timeout for slow pages
go_backUse sparingly; prefer explicit navigation for clarity
scrollSpecify direction and distance; use to reveal lazy-loaded content

Navigate configuration tips:

  • Set wait_for_navigation: true for pages with redirects
  • Increase timeout (30-60s) for slow-loading pages
  • Use open_in_new_tab when testing multi-tab workflows

Interaction Actions

ActionWhen to Use
clickStandard button/link interactions
double_clickFile selection, text selection, specialized UI
right_clickContext menus
hoverReveal tooltips, dropdown menus, hidden elements

Tips:

  • Add a wait step after clicking if the next element needs time to appear
  • Use hover before click for menu items that require hover to reveal

Input Actions

ActionWhen to UseKey Parameter
typeFill text fieldsclear_first for editing existing values
select_optionDropdownsoption_text matches visible label
send_keysKeyboard shortcutskeys like "Enter", "Tab", "Escape"
submit_formForm submissionAlternative to clicking submit button

Type vs. Fill:

  • Use clear_first: true when editing pre-filled fields
  • Without clear_first, text appends to existing content

Control Actions

ActionWhen to Use
waitPage transitions, loading states, animations
doneMark flow completion (optional)
customComplex actions not covered by standard types

Wait strategy:

  • Prefer wait_for_element over fixed duration when possible
  • Use condition for complex waits: "Wait until loading spinner disappears"
  • Keep timeouts reasonable (5-30 seconds) to catch real issues
caution

Avoid excessive wait steps with long durations. They slow tests and hide real performance issues. If you need many long waits, the application may have performance problems worth investigating.

Assertion Best Practices

Choosing Assertion Types

AssertionBest ForExample
visual_verificationComplex UI states"Verify the shopping cart shows 3 items"
element_visibleConfirming element appeared"The success message is visible"
element_hiddenConfirming element disappeared"The loading spinner is hidden"
text_visibleSpecific content validation"Verify 'Order confirmed' text appears"
url_matchesNavigation verification"URL contains '/dashboard'"
navigation_occurredPage transition happenedAfter form submission

When to use each:

  • visual_verification: When you need AI judgment about complex visual states
  • element_visible/element_hidden: For binary presence checks
  • text_visible: When specific text content matters
  • url_matches: After navigation actions
  • custom: For business-logic validations

Assertion Placement Strategy

Add assertions after actions that change application state:

Critical assertion points:

  1. After form submissions
  2. After navigation/redirects
  3. After data modifications (create, update, delete)
  4. After authentication state changes
  5. At flow completion

Balance coverage vs. speed:

  • Critical flows: Assert after every significant action
  • Smoke tests: Assert only final outcome
  • Regression tests: Assert key checkpoints
caution

Avoid over-asserting. Too many assertions make tests brittle and slow. Focus on outcomes that matter to users.

Flow Configuration Settings

Timeout and Retry Settings

SettingRecommendationUse Case
Timeout30s default, 60s for slow pagesAdjust based on actual page performance
Retry Count1-2 for flaky elements, 0 for stableUse sparingly; fix root cause instead

When to increase timeouts:

  • Pages with heavy JavaScript
  • Third-party integrations (payments, maps)
  • File uploads or downloads

When to increase retries:

  • Elements with animations
  • Dynamically loaded content
  • Known intermittent issues (temporary workaround)

Priority and Complexity

Use these fields for team communication and test suite organization:

  • Priority: Order flows in execution queues (P1 runs first)
  • Complexity: Help teammates understand maintenance burden

Common Pitfalls to Avoid

Pitfall 1: Overly Long Flows

Problem: Flows with 20+ steps are hard to debug and maintain.

Solution: Split into focused flows. Chain them if needed for end-to-end scenarios.

Pitfall 2: Vague Element Descriptions

Problem: "The button" or "input field" matches multiple elements.

Solution: Add visual context—color, position, label text, surrounding elements.

Pitfall 3: Missing Assertions

Problem: Flow runs but doesn't verify anything meaningful.

Solution: Add assertions after state-changing actions. Every flow should verify at least one outcome.

Pitfall 4: Ignoring Timing Issues

Problem: Flows fail intermittently due to race conditions.

Solution: Use wait_for_element instead of fixed waits. Increase timeouts for genuinely slow pages.

Pitfall 5: Not Using Browser Profiles

Problem: Flows requiring authentication re-login every run, wasting steps.

Solution: Create browser profiles with saved sessions. Select them during execution.

Flow Generation from Discovery

When to Use Discovery-Generated Flows

Discovery-generated flows provide quick baseline coverage:

Advantages:

  • Fast creation (1 credit per flow)
  • Based on actual application structure
  • Includes visual context for assertions

Considerations:

  • May need refinement for specific scenarios
  • Generic naming (customize after generation)
  • Best as starting points, not final flows

Refining Generated Flows

After generating flows from discovery:

  1. Review step accuracy: Ensure actions match intended user journey
  2. Improve targeting descriptions: Add visual cues for precision
  3. Add missing assertions: Discovery captures state, not all validations
  4. Rename flows: Replace generic names with descriptive ones
  5. Set priority and status: Organize for your test suite

Refinement costs 1 credit per adjustment—much cheaper than regenerating.

Next Steps