Skip to content

Root Cause Analysis

When the Quality Matrix flags a test as Flaky or Critical, the Root Cause Analysis (RCA) engine investigates why. It compares logs across multiple runs and proposes targeted fixes.

DNA Diagnostics

DNA Diagnostics compares the execution traces of a test across its recent pass and fail runs. The AI identifies patterns that differ between passing and failing executions:

text
Test: checkout.spec.ts — "should apply discount code"

Passing runs (12/15): element found in 200ms, assertion succeeds
Failing runs (3/15):  element not found after 5000ms timeout

DNA match: selector resolves late on slow network conditions

Multiple Failures

DNA Diagnostics is most effective when a test has failed at least 3 times. With fewer data points, the confidence score is lower and the diagnosis may be speculative.

Root Cause Categories

The AI classifies each issue into one of several predefined categories:

CategoryDescriptionFrequency
Broad LocatorSelector matches multiple elements or depends on DOM order~35% of flaky tests
Race ConditionTest acts before the page finishes rendering or an API responds~30% of flaky tests
Missing WaitNo explicit wait for an element, network request, or animation~20% of flaky tests
Test Data DependencyTest assumes specific data state that varies between runs~10% of flaky tests
InfrastructureFailure caused by system resource limits, not test code~5% of flaky tests

Each diagnosis includes the specific lines of code involved and an explanation of the timing or selector issue.

Auto-Fix Suggestions

After identifying the root cause, xyva generates a concrete code fix:

typescript
// BEFORE (Broad Locator — matches 3 elements)
await page.click('.btn');

// AFTER (Scoped to specific section)
await page.getByRole('button', { name: 'Submit Order' }).click();

The suggestion appears as a diff panel with the original code on the left and the proposed fix on the right.

Review Before Applying

Auto-Fix suggestions are AI-generated and may not account for all edge cases. Always review the proposed change before applying it to your codebase.

Initialize Repair

Click the Initialize Repair button to send the suggested fix to the Architecture module for a broader impact assessment. Architecture checks whether:

  • The fix introduces any new selector conflicts
  • Other tests reference the same element
  • The change aligns with existing Page Object patterns

After review, you can apply the fix directly or export it as a patch file.

RCA Workflow

text
1. Intelligence flags test as Flaky or Critical
2. Click the test cell in the Quality Matrix
3. DNA Diagnostics runs automatically (compares pass vs. fail traces)
4. Root cause category is displayed with confidence score
5. Auto-Fix suggestion is generated (review required)
6. Review the suggested fix
7. Click "Initialize Repair" to validate through Architecture
8. Apply the fix and re-run to confirm resolution

Confidence Score

The confidence score (0-100%) reflects how consistent the failure pattern is across runs. Scores above 80% indicate a reliable diagnosis. Below 50%, consider manual investigation.

Local-first QA orchestration.