Back to Blog
Software Testing

How to Debug Failing Tests in TestInspector: Using Run Logs, WebSocket Streaming, and AI Selector Suggestions

Avanish Pandey

July 26, 2026

How to Debug Failing Tests in TestInspector: Using Run Logs, WebSocket Streaming, and AI Selector Suggestions

How to Debug Failing Tests in TestInspector: Using Run Logs, WebSocket Streaming, and AI Selector Suggestions

When a test fails in TestInspector, the debugging workflow starts with the run log: a step-by-step record of what each test step executed, what assertion was checked, and what response the application returned. For element-not-found failures — the most common failure mode in browser automation — TestInspector augments the run log with AI-generated selector alternatives, giving you a ranked list of replacement selectors to evaluate before the next retry. For timing and state failures, live WebSocket streaming lets you watch a test run execute in real time rather than waiting for the run to complete before reviewing what went wrong.

TestInspector does not require writing debug code to inspect failing tests. The run log, streaming view, and AI selector panel are built into the platform interface and available for every run without configuration.

For QA teams managing test suites across multiple environments and browser configurations, understanding which failure in a run log indicates a real application defect versus a test infrastructure issue versus a selector drift is the core debugging skill that determines how quickly failures are resolved. This guide covers each debugging tool available in TestInspector and the failure patterns each one is designed to address. For teams evaluating test automation services that reduce the investigation burden on manual QA, the debugging tools described here are relevant to the total cost of maintaining an automated test suite. You can explore the full TestInspector platform at TestInspector.

Reading the TestInspector Run Log

The run log is the primary debugging artifact for any test failure. It shows the execution sequence: each step in the test, the selector used (for element interactions), the action taken, and the result. For failing steps, the log includes the failure reason, the actual response or state the application returned, and the expected value from the assertion.

A step that fails because the element was not found shows the selector string that was attempted, the DOM context available at the time of the lookup, and the retry count before the step was marked as failed. A step that fails because an assertion did not match shows the expected value and the actual value side by side. A step that fails because an HTTP request returned an unexpected status code shows the full response status and the body excerpt that caused the assertion failure.

The run log is organized sequentially: steps appear in execution order, each with a timestamp. This makes it straightforward to identify whether a failure occurred at the beginning (suggesting an environment or authentication problem), in the middle of a flow (suggesting a state-dependent failure), or on a specific assertion (suggesting a data or content mismatch).

Common run log failure patterns and their root causes:

Failure Pattern in LogMost Likely Root CauseDebugging Next Step
Element not found, selector unchangedApplication DOM structure changedReview AI selector suggestions, inspect element in browser
Element not found, intermittentTiming issue, element loads after actionIncrease implicit wait or add explicit wait step
Assertion failed: expected vs. actual text mismatchDynamic content, test data changedCheck whether the expected value needs parameterization
HTTP 401 or 403 on request stepAuthentication token expired or missingCheck variable storing auth token, verify login step succeeded
HTTP 500 on request stepApplication-side errorCheck application logs for the matching request timestamp
Screenshot comparison failedVisual regression: layout or styling changedReview baseline and current screenshot diff in SSIM panel
Step timeout exceededPage load slow, network latencyCheck environment health, verify timeout setting is appropriate

The table above covers the most common patterns. Less common failures — such as steps that pass but produce unexpected side effects visible later in the flow — require tracing the execution sequence from the first incorrect state forward.

Live WebSocket Streaming for Real-Time Run Visibility

TestInspector streams run output over WebSocket as tests execute. Instead of waiting for a run to complete and then reviewing the final log, the streaming view shows each step completing or failing as it happens. This is particularly useful for long test runs where a failure occurs partway through and the cause is visible in real-time context — for example, a login step that completes successfully but produces an incorrect session state that causes all subsequent steps to fail.

The streaming view provides the same step-by-step data as the final run log but without the wait. For debugging, the streaming view is most useful when the failure mode is unclear from the log alone and you want to watch the test execute against the application in context.

For CI/CD-integrated runs, the WebSocket stream is available via the API, which means the same real-time data can be consumed by external monitoring or notification systems. Teams that have configured a CI/CD trigger API to run TestInspector test suites as part of their deployment pipeline can consume the stream output programmatically to feed deployment dashboards or to gate deployments on test outcomes in real time. See our test automation services for teams looking to integrate this kind of real-time test output into their deployment workflows.

AI Selector Suggestions for Element-Not-Found Failures

The most frequent failure mode in browser automation is an element that cannot be found because the application's DOM structure changed. Selector drift — where a previously working CSS selector, XPath, or ID stops matching after a UI update — is the primary driver of test maintenance overhead in traditional automation frameworks.

When TestInspector fails to find an element using the recorded selector, it analyzes the current DOM and generates AI-suggested alternative selectors ranked by stability likelihood. Stable selectors prioritize unique data attributes, stable ID patterns, and semantic HTML attributes over positional selectors (nth-child, nth-of-type) or class names that change with style updates.

The AI selector panel shows each suggested alternative with a preview of the element it would match, so you can confirm the correct match before saving the updated selector to the test. Once updated, the test uses the new selector on subsequent runs without requiring a full test re-record.

This workflow reduces selector maintenance from a code edit task (modifying test scripts) to a review-and-confirm task. The QA engineer reviews the AI suggestions, selects the correct element, and saves the update. The operational difference is that this work requires no programming knowledge, which means non-developer QA engineers can resolve selector failures without escalating to a developer. For teams evaluating TestInspector, this self-healing capability directly reduces the per-test maintenance cost of keeping automated coverage current as the application evolves.

Debugging Visual Regression Failures

Visual regression tests in TestInspector compare a captured screenshot against an approved baseline using SSIM (Structural Similarity Index Measure) scoring. A visual regression step fails when the SSIM score drops below the configured similarity threshold, indicating that the current screenshot differs from the baseline beyond the accepted tolerance.

When a visual regression step fails, the debugging workflow starts in the screenshot comparison panel: the baseline image, the current image, and a diff view that highlights the changed regions. The diff view uses pixel-level highlighting to show exactly which areas changed, which makes it possible to determine whether the change is a real regression (a layout broke), an expected change (a new feature changed the UI intentionally), or a false positive (minor rendering differences from anti-aliasing or font rendering between environments).

For debugging visual regression failures: open the comparison panel for the failed step and review the highlighted diff regions. Localized, structural changes — a button moved, a text block shifted, a component disappeared — indicate a real regression. Distributed, pixel-level noise across the full image suggests a rendering environment difference. If the change is intentional, update the baseline to approve the new appearance. TestInspector supports crop and exclusion selectors in visual regression steps to exclude dynamic content areas — timestamps, user-specific data, advertisement placeholders — from comparison, reducing false-positive failures from content that legitimately changes between runs.

Distinguishing Test Failures from Application Defects

Not every test failure in TestInspector represents an application defect. A significant proportion of failures in any test suite are caused by test infrastructure issues, selector drift, timing mismatches, or environment instability. The debugging workflow must distinguish between these categories because the resolution actions are different.

A useful triage heuristic: if the same test passes in one environment but fails in another, the failure is likely environment-specific (different data state, different configuration, authentication differences). If multiple unrelated tests fail simultaneously, the failure is likely environmental rather than test-specific — check whether the application is accessible, whether authentication is working, and whether any recent deployments changed global configuration. If a test fails intermittently, the failure is likely a timing issue or a race condition in the application.

If the failure is on an element-not-found step and the AI selector suggestions match a clearly different element than intended, the application DOM structure changed significantly enough that a new recording of that section is needed rather than a selector update.

For teams building formal QA processes around TestInspector, the testing documentation framework should include a triage protocol that maps common failure patterns to standard resolution paths. See also our software testing services for teams that want external QA support for root cause analysis and test suite stabilization. The AI in software testing guide provides broader context on how AI-assisted debugging tools are changing the economics of test maintenance in 2026.

Frequently Asked Questions

Where do I find the run log for a specific test execution in TestInspector?

The run log is accessible from the run history view for any test or suite. Select the specific run and open the detail view to see the step-by-step execution log. Each step shows its status (pass, fail, skipped), the action taken, and for failures, the failure reason and the actual vs. expected values. For runs triggered via the CI/CD API, the same log is accessible through the API response for that run.

What does self-healing mean in the context of TestInspector?

Self-healing refers to TestInspector's behavior when an element-not-found failure occurs: the platform automatically analyzes the current DOM and attempts to identify a matching element using AI-generated alternative selectors. If a high-confidence match is found, the test retries the step with the suggested selector rather than immediately marking it as failed. This reduces the number of failures caused by minor selector drift and provides alternative selectors for review regardless of whether the retry succeeded.

How does visual regression comparison work in TestInspector?

Visual regression steps in TestInspector capture a screenshot at a specific point in the test and compare it against an approved baseline using SSIM scoring. The similarity threshold is configurable, and exclusion selectors allow specific UI regions to be excluded from comparison. When a failure occurs, the comparison panel shows the baseline, the current screenshot, and a diff highlighting changed regions. Updating the baseline approves the new appearance as the reference for future comparisons.

Can I debug a failing test without re-running it?

The run log and screenshot comparison for any failed run are stored and accessible after the run completes. You can review the step-by-step log, the AI selector suggestions for element failures, and the visual diff for screenshot failures without triggering a new run. This is useful for investigating failures that occurred in automated CI/CD runs, where re-running may take time or may not reproduce the original failure state.

What should I check first when a previously passing test starts failing?

Start with the first failing step in the run log and check the failure reason: element not found, assertion mismatch, HTTP error, or timeout. For element failures, check the AI selector suggestions to see whether the DOM structure changed and whether an alternative selector is available. For assertion failures, check whether the expected value in the assertion is still correct given recent application changes. If the first step is failing, check whether the application environment is accessible and whether authentication is completing successfully.

How do I know whether a visual regression failure is a real bug or a rendering difference?

Open the diff view in the comparison panel and examine the highlighted regions. Structural changes — a component moved, a text block is missing, a button changed size — indicate a real regression. Distributed pixel-level differences across the entire image typically indicate environment-level rendering differences that are not functional regressions. Configuring exclusion selectors for known dynamic regions reduces false positives from content that legitimately changes between runs. Refer to the complete guide to software testing for context on how visual regression fits into a broader QA strategy.

Related: AI in software testing guide 2025 — covers how AI tools are being applied across test generation, maintenance, and failure analysis in modern QA workflows.

Avanish Pandey

July 26, 2026

icon
icon
icon

Subscribe to our Newsletter

Sign up to receive and connect to our newsletter

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Latest Article

Ask our AI assistant…