/staf:test-result-analyzerfrom staf
Analyzes STAF test logs and HTML reports to classify failures and identify root causes by matching against known failure patterns.
Ships in staf. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Analyzes STAF test results from log files, HTML reports, and API job output. Identifies root causes by classifying failures against known patterns.
This skill requires a trusted STAF checkout — a working tree the
operator has verified out-of-band as either the official upstream
(https://github.com/Azure/sap-automation-qa.git) or a fork of it, at a
specific revision, with the framework marker ./scripts/sap_automation_qa.sh
present. The operator must have verified both the source (upstream URL or
fork URL) and the revision through a trusted out-of-band channel before
running this skill, and must have cd-ed into that directory. If that
state is not confirmed, stop and use the setup-guide skill first; it owns
the setup workflow. Do not resume this skill until setup-guide (or the
operator directly) confirms the checkout is trusted.
⚠️ This skill is guidance only. Do NOT modify any source code, scripts, or framework files. Only help the user by reading logs, running diagnostic commands, and reporting findings.
| Trigger | Action |
|---|---|
analyze results / why did test fail | Root cause analysis |
test output / read test log | Parse and interpret logs |
check test status | Review job/test status |
interpret report | Read HTML report |
what happened in test | Timeline reconstruction |
| File | Path | Format |
|---|---|---|
| Test results | WORKSPACES/SYSTEM/{name}/logs/{invocation_id}.log | JSON lines |
| Execution log | WORKSPACES/SYSTEM/{name}/logs/execution_{timestamp}.log | Plain text (Ansible) |
| HTML report | WORKSPACES/SYSTEM/{name}/quality_assurance/{group}_{invocation}.html | HTML |
| Source | Command |
|---|---|
| Job status | ./scripts/sap_automation_qa.sh job get --id <JOB_ID> |
| Job log | ./scripts/sap_automation_qa.sh job log --id <JOB_ID> [--tail N] |
| Job events | ./scripts/sap_automation_qa.sh job events --id <JOB_ID> |
| List active | ./scripts/sap_automation_qa.sh job list --active |
Each line is a JSON object representing one test case result:
{
"test_case_name": "ha-config",
"test_case_id": "ha-config",
"test_group_name": "DatabaseHighAvailability",
"test_group_invocation_id": "abc123-def456",
"status": "PASSED",
"severity": "CRITICAL",
"start_time": "2024-01-15T10:00:00Z",
"end_time": "2024-01-15T10:05:30Z",
"duration_seconds": 330,
"message": "All checks passed",
"details": {}
}
Status values: PASSED, FAILED, SKIPPED, ERROR
Severity values: CRITICAL, HIGH, MEDIUM, LOW
Raw Ansible output containing:
ok, changed, failed, skipped, unreachable)PLAY RECAP summary at the end# Direct mode — find latest logs
ls -lt WORKSPACES/SYSTEM/{name}/logs/ | head -5
# API mode — find latest job
./scripts/sap_automation_qa.sh job list --active
# Find failed test cases in JSON log
grep '"status": "FAILED"' WORKSPACES/SYSTEM/{name}/logs/{invocation_id}.log
# Find failures in execution log
grep -E "fatal:|FAILED!|UNREACHABLE" WORKSPACES/SYSTEM/{name}/logs/execution_*.log
Consult references/known-failures.md for:
If no match found: Report the raw error. Do NOT fabricate root causes. Say "Unknown failure pattern — manual investigation needed."
Use the Output Format below.
| Pattern | Meaning |
|---|---|
fatal: [host]: FAILED! => {...} | Task failed on host |
UNREACHABLE! => {...} | Cannot connect (SSH/network) |
NO MORE HOSTS LEFT | All hosts unreachable, playbook aborted |
rescued: | Failure handled by rescue block |
...ignoring | Failed but ignore_errors: true |
PLAY RECAP | Overall summary per host |
PLAY RECAP ***************
host1 : ok=45 changed=3 unreachable=0 failed=0 skipped=12 rescued=0 ignored=0
host2 : ok=43 changed=2 unreachable=0 failed=1 skipped=14 rescued=0 ignored=0
failed > 0 → test failedunreachable > 0 → connectivity issuerescued > 0 → errors caught by block/rescueignored > 0 → non-critical failures suppressed## Test Result Analysis: {workspace_name}
**Invocation:** {invocation_id}
**Test Group:** {group_name}
**Duration:** {total_duration}
**Overall:** X/Y passed, Z failed
### Failed Tests
#### 1. {test_case_name} (FAILED)
- **Severity:** CRITICAL
- **Duration:** 5m 30s
- **Root Cause:** [classification]
- **Error:** [exact error from log]
- **Fix:** [recommended action]
- **Confidence:** Known pattern / Likely match / Unknown
### Passed Tests
- ha-config: PASSED (2m 15s)
- azure-lb: PASSED (1m 30s)
### PLAY RECAP
{paste PLAY RECAP}
### Prioritized Fix Plan
1. Critical: {fix this first}
2. Important: {fix this next}
### Re-Run Command
./scripts/sap_automation_qa.sh --test-groups={group} --test-cases=[{failed-tests}]
| Category | Pattern | Common Causes |
|---|---|---|
| SSH/Connection | Connection refused, timeout | Network, key mismatch, host down |
| Cluster | resource not found, CIB error | Cluster not configured, node offline |
| SAP | HDB info failed, sapcontrol error | SAP not running, wrong SID/instance |
| Azure | MSI auth failed, subscription error | Identity issues, permissions |
| Configuration | parameter missing, invalid value | Workspace misconfiguration |
| Timeout | exceeded timeout, no response | Slow recovery, resource contention |
| Fencing | fence agent failed, SBD error | Fencing misconfiguration |
See references/known-failures.md for detailed patterns.
Identify the root failure (earliest in chain):
Patterns suggesting transient issues:
[DEPRECATION WARNING]: — informational[WARNING]: Platform ... discovered Python interpreter — safeskipping: [host] — expected conditionalsok: [host] with changed=false — idempotent checksCompare current results against previous runs to detect regressions or intermittent failures.
# List recent invocations
ls -lt WORKSPACES/SYSTEM/{name}/logs/*.log | head -10
# Diff two JSON-lines logs (compare test statuses)
diff <(grep -o '"test_case_name": "[^"]*", "status": "[^"]*"' {old_invocation}.log | sort) \
<(grep -o '"test_case_name": "[^"]*", "status": "[^"]*"' {new_invocation}.log | sort)
| Pattern | Meaning |
|---|---|
| Test was PASSED, now FAILED | Regression — investigate recent changes |
| Test was FAILED, now PASSED | Fix confirmed — or intermittent issue |
| Test was SKIPPED, now FAILED | New test coverage — expected first-time failure |
| Duration increased >50% | Performance regression — check resource contention |
| Error | Cause | Fix |
|---|---|---|
| No log files found | Test not yet run | Check path, run test first |
| Empty log file | Test crashed | Check execution log for errors |
| JSON parse error | Corrupted log | Use execution log instead |
| No HTML report | Report not triggered | Check if test completed normally |
| Unknown failure pattern | Not in known-failures.md | Report raw error, flag as Unknown |
Before reporting analysis complete:
| Need to... | Use skill |
|---|---|
| Re-run failed tests | test-runner |
| Fix workspace config issues | workspace-validator |
| Understand test cases | test-runner skill, see its test-catalog.md |
| Set up environment | setup-guide |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub azure/sap-automation-qa --plugin staf5 skills in this plugin
/setup-guideGuide for setting up the SAP Testing Automation Framework itself on a management server — Python venv, Docker, vars.yaml, Copilot integration. Use for framework installation, not for creating a workspace for a specific SAP system (see workspace-creator). Use when asked about installation, setup, Docker deployment, or Copilot integration. Triggered by "setup environment", "install staf", "how to get started", "container start", "setup.sh", "configure vars.yaml", "setup help", or "docker deployment".
/test-runnerExecute STAF tests using sap_automation_qa.sh. Supports direct Ansible execution and API mode. Use when asked to run tests, execute configuration checks, or start HA tests on SAP systems. Triggered by "run test", "execute ha test", "start test", "run configuration check", "test my system", or "trigger test job".
/workspace-creatorCreate new SAP workspace configurations for STAF testing — generates sap-parameters.yaml and hosts.yaml under WORKSPACES/SYSTEM/ from templates. Use when asked to create a workspace or onboard a new SAP system in an existing STAF installation; not for installing STAF itself (see setup-guide) and not for checking a workspace that already exists (see workspace-validator). Triggered by "create workspace", "new workspace", "onboard system", "onboard SAP system", "add new system", "generate hosts.yaml", "generate sap-parameters", or "setup SAP system for testing".
/workspace-validatorValidate an existing SAP workspace configuration before running tests — checks sap-parameters.yaml, hosts.yaml, and SSH auth readiness. Use when asked to validate or troubleshoot a workspace that already exists; not for creating a new one from scratch (see workspace-creator) and not for framework installation issues (see setup-guide). Triggered by "validate workspace", "check workspace", "workspace issues", "fix workspace", "sap-parameters check", "hosts.yaml check", "SSH auth problems", or "troubleshoot workspace".
Other plugins' skills for the same job