Back to Documentation

Writing Effective Tests

Well-written tests are the foundation of reliable monitoring. Follow these guidelines to create tests that are robust and easy to maintain.

Be Specific and Clear

Write test steps that clearly describe the intended action:

Good:

Click the "Add to Cart" button next to the product

Avoid:

Click the button

Use Descriptive Verifications

When verifying results, be explicit about what you expect:

Good:

Verify that the success message "Your order has been placed" is displayed

Avoid:

Check if it worked

Test One Flow at a Time

Keep tests focused on a single user journey:

  • Login test
  • Checkout test
  • Search test

Don't combine unrelated flows in a single test.

Handle Dynamic Content

For content that changes (like dates or generated IDs), use flexible verifications:

Verify that a confirmation number is displayed

Instead of:

Verify that "Order #12345" is displayed

Account for Loading States

Web applications often have loading states. Our AI handles most waits automatically, but you can be explicit when needed:

Wait for the product list to load
Click the first product

Organize Your Tests

Group related tests together:

  • Smoke Tests: Critical paths that must always work
  • Feature Tests: Specific feature functionality
  • Regression Tests: Previously broken functionality

Common Patterns

Form Submission

Navigate to the contact form
Enter "John Doe" in the name field
Enter "john@example.com" in the email field
Enter "Hello, I have a question" in the message field
Click the "Send" button
Verify that "Thank you for your message" is displayed

Navigation

Navigate to the homepage
Click "Products" in the navigation menu
Verify that the products page is displayed
Click the first product
Verify that the product details are shown

Search

Navigate to the homepage
Enter "blue shoes" in the search box
Press Enter or click the search button
Verify that search results are displayed
Verify that results contain "blue" or "shoes"