agentleFS
Microsoft AzureKnown publisherAzure/sap-automation-qa/skills/test-result-analyzer/SKILL.md

test-result-analyzer

Skill14 starsChanged 58 days agoMITView on GitHub

Analyze STAF test results and identify root causes. Use when asked about test failures, what went wrong, or to interpret test output. Triggered by "analyze results", "why did test fail", "test output", "check test status", "read test log", "interpret report", or "what happened in test".

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the Output Format below.

    line 129
  2. Distinctive:

    Before reporting analysis complete:

    line 267

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Test Result Analyzer

Analyzes STAF test results from log files, HTML reports, and API job output. Identifies root causes by classifying failures against known patterns.

Locate Framework

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.

When to Use

TriggerAction
analyze results / why did test failRoot cause analysis
test output / read test logParse and interpret logs
check test statusReview job/test status
interpret reportRead HTML report
what happened in testTimeline reconstruction

Result File Locations

Direct Execution Mode

FilePathFormat
Test resultsWORKSPACES/SYSTEM/{name}/logs/{invocation_id}.logJSON lines
Execution logWORKSPACES/SYSTEM/{name}/logs/execution_{timestamp}.logPlain text (Ansible)
HTML reportWORKSPACES/SYSTEM/{name}/quality_assurance/{group}_{invocation}.htmlHTML

API Mode

SourceCommand
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

Log File Formats

JSON Lines Log ({invocation_id}.log)

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

Execution Log (execution_{timestamp}.log)

Raw Ansible output containing:

  • Task names and results (ok, changed, failed, skipped, unreachable)
  • Error messages and stack traces
  • SSH connection issues
  • Command output from remote hosts
  • PLAY RECAP summary at the end

Analysis Workflow

Step 1: Locate Results

# 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

Step 2: Parse for Failures

# 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

Step 3: Match Against Known Patterns

Consult references/known-failures.md for:

  • Exact string matches against log patterns
  • Error code matches (exit codes)
  • Component matches (pacemaker, sapcontrol, HANA)

If no match found: Report the raw error. Do NOT fabricate root causes. Say "Unknown failure pattern — manual investigation needed."

Step 4: Present Structured Report

Use the Output Format below.

Parsing Ansible Logs

Key Patterns (in severity order)

PatternMeaning
fatal: [host]: FAILED! => {...}Task failed on host
UNREACHABLE! => {...}Cannot connect (SSH/network)
NO MORE HOSTS LEFTAll hosts unreachable, playbook aborted
rescued:Failure handled by rescue block
...ignoringFailed but ignore_errors: true
PLAY RECAPOverall summary per host

Play Recap Analysis

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 failed
  • unreachable > 0 → connectivity issue
  • rescued > 0 → errors caught by block/rescue
  • ignored > 0 → non-critical failures suppressed

Output Format

Test Result Analysis

## 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}]

Failure Classification

CategoryPatternCommon Causes
SSH/ConnectionConnection refused, timeoutNetwork, key mismatch, host down
Clusterresource not found, CIB errorCluster not configured, node offline
SAPHDB info failed, sapcontrol errorSAP not running, wrong SID/instance
AzureMSI auth failed, subscription errorIdentity issues, permissions
Configurationparameter missing, invalid valueWorkspace misconfiguration
Timeoutexceeded timeout, no responseSlow recovery, resource contention
Fencingfence agent failed, SBD errorFencing misconfiguration

See references/known-failures.md for detailed patterns.

Advanced Analysis

Cascading Failures

Identify the root failure (earliest in chain):

  • SSH fails → All tasks on that host UNREACHABLE
  • Cluster constraint not cleared → Migration fails → Failover tests fail
  • HANA not running → All HANA-specific checks fail

Intermittent Failures

Patterns suggesting transient issues:

  • "Timeout waiting for resource" (retry may succeed)
  • "Connection reset by peer" (network hiccup)
  • "Resource is starting" (timing issue)

Log Noise (Safe to Ignore)

  • [DEPRECATION WARNING]: — informational
  • [WARNING]: Platform ... discovered Python interpreter — safe
  • skipping: [host] — expected conditionals
  • ok: [host] with changed=false — idempotent checks

Historical Comparison

Compare current results against previous runs to detect regressions or intermittent failures.

Compare Two Invocations

# 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)

Regression Detection Patterns

PatternMeaning
Test was PASSED, now FAILEDRegression — investigate recent changes
Test was FAILED, now PASSEDFix confirmed — or intermittent issue
Test was SKIPPED, now FAILEDNew test coverage — expected first-time failure
Duration increased >50%Performance regression — check resource contention

Error Handling

ErrorCauseFix
No log files foundTest not yet runCheck path, run test first
Empty log fileTest crashedCheck execution log for errors
JSON parse errorCorrupted logUse execution log instead
No HTML reportReport not triggeredCheck if test completed normally
Unknown failure patternNot in known-failures.mdReport raw error, flag as Unknown

Pre-Completion Checklist

Before reporting analysis complete:

  • ALL failed tests analyzed (not just first failure)
  • Each failure has exact error text from log (not paraphrased)
  • Root causes matched from known-failures.md or flagged Unknown
  • Remediation steps are specific and actionable
  • Re-run command provided for failed tests
  • PLAY RECAP included in report

Related Skills

Need to...Use skill
Re-run failed teststest-runner
Fix workspace config issuesworkspace-validator
Understand test casestest-runner skill, see its test-catalog.md
Set up environmentsetup-guide

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.