Assertions

Assertions verify that your test achieved the expected outcome. They're evaluated by AI using screenshots and page state.

What Are Assertions?

Assertions are statements that should be true after all steps complete:

"User should be logged in"
"Shopping cart should contain 2 items"
"Error message should not be visible"

The AI evaluates each assertion and reports pass/fail with a confidence score.

Adding Assertions

  1. Open a test case
  2. Scroll to the Assertions section
  3. Click Add Assertion
  4. Enter your assertion text
  5. Click Save

Writing Effective Assertions

Be Specific

❌ "Page looks correct"
✅ "Welcome message 'Hello, John!' is visible"

State What Should Be True

❌ "Check if login worked"
✅ "User dashboard is displayed"

Include Identifiable Elements

❌ "Button exists"
✅ "'Logout' button is visible in the header"

Assertion Examples

Visibility Assertions

The user profile menu is visible
The loading spinner is not visible
The error message is hidden
The success toast appears

Content Assertions

The page title contains "Dashboard"
The welcome message shows the user's name
The cart total displays "$99.00"
The product list shows 5 items

State Assertions

User is logged in
The form has been submitted successfully
The modal is closed
The sidebar is collapsed

Negative Assertions

No error messages are displayed
The login form is not visible
The "Submit" button is not disabled

How AI Evaluates Assertions

  1. Takes a screenshot of the current page
  2. Analyzes page accessibility tree
  3. Multiple AI models evaluate the assertion
  4. Returns pass/fail with confidence score
  5. If models disagree, an arbiter model decides

Bug0 uses consensus-based assertion evaluation with Claude and Gemini models for reliability.

Assertion Results

Each assertion returns:

FieldDescription
Pass/FailWhether the assertion passed
ConfidenceHow certain the AI is (0-100%)
ReasoningWhy the AI made this decision

Handling Failures

When an assertion fails:

  1. Review the AI's reasoning
  2. Check the screenshot at assertion time
  3. Verify if the assertion text is clear
  4. Consider if the test steps completed correctly

Draft vs Published Assertions

Like steps, assertions have draft and published versions:

Click Publish to promote draft assertions.

Best Practices

Common Patterns

After Login

User's name is displayed in the header
Dashboard page is visible
Logout button is present

After Form Submission

Success message is displayed
Form fields are cleared
Submit button is no longer loading

After Adding to Cart

Cart count increased by 1
Product appears in cart summary
"Added to cart" confirmation shows

After Search

Search results are displayed
Result count shows number of matches
Search query appears in the search box