Test Analyzer Agent
An NLP-driven agent that ingests test results, classifies failures by root cause, clusters related issues, generates human-readable summaries, and creates Jira tickets with diagnostic evidence.
92%
Classification accuracy
70%
Triage time reduction
6
Categories
About
Test Analyzer Agent processes test output from Playwright and other frameworks, uses NLP to classify failures into categories (assertion, timeout, locator, infrastructure, environment), clusters related failures, generates concise root-cause summaries, and creates Jira tickets with traces, screenshots, and reproduction steps.
Problem
Test failure analysis is manual, slow, and inconsistent. Engineers spend hours triaging the same failure patterns across suites, environments, and CI runs. This agent automates classification, clustering, and documentation.
Architecture
The agent ingests test results through a FastAPI endpoint, normalises them into a common schema, classifies each failure using a fine-tuned NLP model, and clusters related failures using DBSCAN. An LLM generates root-cause summaries per cluster. The agent then creates Jira tickets with attached logs, screenshots, and reproduction commands. All results are stored in PostgreSQL for trend analysis.
Pipeline
TEST_ANALYZER_AGENT_PIPELINE
Workflow
Code
from test_analyzer.classifier import FailureClassifier
from test_analyzer.cluster import FailureClusterer
from test_analyzer.summariser import RootCauseSummariser
classifier = FailureClassifier()
clusterer = FailureClusterer(eps=0.3, min_samples=2)
summariser = RootCauseSummariser(model="gpt-4")
results = ingest_test_run("playwright-report.json")
failures = [r for r in results if not r.passed]
for f in failures:
f.category = classifier.classify(f.error_message)
clusters = clusterer.cluster(failures)
for cluster_id, group in clusters.items():
summary = summariser.summarise(group)
jira_issue = create_jira_ticket(
summary=summary,
failures=group,
project="QA",
)
print(f"Cluster {cluster_id}: {jira_issue.key}")class FailureCategory(str, Enum):
ASSERTION = "assertion"
TIMEOUT = "timeout"
LOCATOR = "locator"
INFRASTRUCTURE = "infrastructure"
ENVIRONMENT = "environment"
UNKNOWN = "unknown"
CLASSIFICATION_PROMPT = """
Classify this test failure into one of:
- assertion: value mismatch, unexpected state
- timeout: wait expired, element not found
- locator: selector unable to find element
- infrastructure: network, disk, container
- environment: config, data, dependency
Failure message: {error_message}
Page URL: {page_url}
Action: {action}
Respond with only the category name.
"""Quick start
Current functionality
- Playwright and JUnit XML input
- NLP classification: assertion, timeout, locator, infra, env
- Dynamic clustering of related failures
- LLM-generated root-cause summaries
- Automatic Jira ticket creation
- Trend tracking across CI runs
- Failure rate dashboards
- Docker containerised deployment
Limitations
- Classification accuracy depends on failure message quality
- LLM summaries need human review for critical issues
- Jira integration requires API credentials
- Trend analysis requires persistent storage
Planned improvements
- Add Slack/Teams notifications
- Add failure prediction based on trends
- Support additional test frameworks
- Add automated rollback suggestions
Technology
Related capabilities
Status
experimentalThis project is an active experimental framework. It is not production-ready and should be evaluated for your specific use case.
Interested in this project?
Stagbyte builds practical automation systems. If this project aligns with a problem you are solving, reach out to discuss how it can be adapted or extended.