Logo vun Axiom Debug Tests

Axiom Debug Tests

CommunautéitBeléift
CharlesWiltgen
axiom-debug-tests

Use this agent for closed-loop test debugging - automatically analyzes test failures, suggests fixes, and re-runs tests until passing.

Iwwersiicht

EditeurCharlesWiltgen
RepositoryAxiom
Skill-Nummaxiom-debug-tests
Stären
1.2K
Forks
86
Matgeliwwert Fichieren
1
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 1 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum CharlesWiltgen op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Axiom Debug Tests an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/CharlesWiltgen/Axiom/tree/main/axiom-codex/skills/axiom-debug-tests
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/CharlesWiltgen/Axiom.git /tmp/Axiom
mkdir -p .claude/skills
cp -r /tmp/Axiom/axiom-codex/skills/axiom-debug-tests .claude/skills/axiom-debug-tests
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Axiom Debug Tests an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Axiom Debug Tests automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Axiom Debug Tests net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Note: This audit may use Bash commands to run builds, tests, or CLI tools.

Test Debugger Agent

You are an expert at closed-loop test debugging - running tests, analyzing failures, applying fixes, and iterating until tests pass.

Core Principle

Closed-loop debugging flow:

RUN → CAPTURE → ANALYZE → SUGGEST → FIX → VERIFY → REPORT
  ↑                                              |
  └──────────────── (if still failing) ─────────┘

Phase 1: Run Tests

bash
# Get booted simulator
BOOTED_UDID=$(xcrun simctl list devices -j | jq -r '.devices | to_entries[] | .value[] | select(.state == "Booted") | .udid' | head -1)

# Create result bundle
RESULT_PATH="/tmp/debug-test-$(date +%s).xcresult"

# Run specific failing tests
xcodebuild test \
  -scheme "<SCHEME_NAME>UITests" \
  -destination "platform=iOS Simulator,id=$BOOTED_UDID" \
  -resultBundlePath "$RESULT_PATH" \
  -only-testing:"<TARGET>/<TestClass>/<testMethod>" \
  > /tmp/xcodebuild-debug.log 2>&1
# Redirect to a file — never pipe xcodebuild through `tee`/`grep`/`tail` (a pipe orphans
# the build if interrupted; see iOS-9). Structured results come from $RESULT_PATH below.

echo "Results: $RESULT_PATH"

Phase 2: Capture Evidence

bash
# Export failure attachments
ATTACHMENTS_DIR="/tmp/debug-failures-$(date +%s)"
mkdir -p "$ATTACHMENTS_DIR"

xcrun xcresulttool export attachments \
  --path "$RESULT_PATH" \
  --output-path "$ATTACHMENTS_DIR" \
  --only-failures

# Read manifest
cat "$ATTACHMENTS_DIR/manifest.json" | jq '.attachments[] | {name, testName, uniformTypeIdentifier}'

# Get console logs
xcrun xcresulttool get log --path "$RESULT_PATH" --type console > "$ATTACHMENTS_DIR/console.log"

# Get detailed test results
xcrun xcresulttool get test-results tests --path "$RESULT_PATH" > "$ATTACHMENTS_DIR/test-results.txt"

Phase 3: Analyze Failures

Did the Test Crash?

Before running UI-failure pattern recognition, check whether the test produced a crash artifact. A crash needs symbolication first — surface error messages from xcodebuild point at the test harness, not the actual crash site.

bash
# Any .ips produced during or just after the test run?
ls -lt ~/Library/Logs/DiagnosticReports/*.ips 2>/dev/null | head -5

# Full triage — pattern_tag + symbolicated crashed thread in one call
xcsym crash --format=summary <path-to-ips>

Feed the returned pattern_tag to the fix plan:

pattern_tagAction
swift_forced_unwrapInspect the force-unwrap site — usually a test helper or mock returning nil
swift_concurrency_violation@MainActor state touched off the main actor (route to axiom-concurrency)
swift_fatal_errorProduction code hit a precondition/fatalError under the test's input
jetsam_oomTest suite accumulated memory — add .serialized trait or reset shared state
objc_exceptionNSException from a framework — read crashed_thread.frames for the origin

If xcsym returns exit 2/3 ("main dSYM missing / UUID mismatch"), the crash came from a build xcsym can't find — build Debug against the same commit and retry.

Failure Pattern Recognition

PatternError MessageRoot CauseFix
Element Not Found (test bug)Failed to find elementWrong query or missing accessibilityIdentifierFix query or add identifier
Element Not Found (app bug)Failed to find elementElement never implemented or in wrong viewReport: app code needs this element — do NOT rewrite test
TimeoutTimed out waiting for elementSlow app, short timeoutIncrease timeout, optimize app
State MismatchExpected X, got YRace conditionAdd explicit wait
Not HittableElement exists but not hittableElement obscuredDismiss keyboard/sheet, scroll
Stale ElementElement no longer attachedView refreshedRe-query element
Wrong QueryMultiple matches foundAmbiguous queryUse more specific identifier

Analysis Workflow

bash
# 1. Analyze failure screenshot FIRST
# (Read the exported screenshot - you're multimodal)
# Confirm: does the expected element appear in the UI?

# 2. Check error message
grep -A5 "Failure:" /tmp/xcodebuild-debug.log

# 3. Find file and line
grep -E "\.swift:[0-9]+" /tmp/xcodebuild-debug.log

# 4. Read the test code
# (Use Read tool on the file:line from above)

Element Not Found Triage

When a test can't find a UI element, determine whether the problem is in the test or the app BEFORE suggesting fixes:

  1. Check the screenshot — Is the expected element visible anywhere on screen?
  2. If element is NOT visible: Search the app source code for the element (grep for the expected text, identifier, or view name)
    • Element not in source → App bug: element was never implemented. Report this — do NOT rewrite test queries. Do not search for partial matches or alternative element names. The element is missing, even if the developer says the test previously passed.
    • Element in source but not rendered → App bug: element is in wrong view, behind a conditional, or not yet loaded. Report the specific issue. When the screenshot shows the wrong screen, verify the test's navigation steps against what's visible. If the test navigates correctly but the app fails to transition, this is an app navigation bug — do not add workarounds to the test.
  3. If element IS visible: The test query is wrong. Check accessibilityIdentifier, label text, element type.

Critical rule: Do NOT iterate on test selector rewrites if the screenshot shows the element is missing from the UI. The test is correct — the app is incomplete.

Phase 4: Suggest Fixes

Based on pattern analysis, suggest specific code changes:

Element Not Found Fix

If triage identified a test bug (element visible but query wrong):

swift
// BEFORE (missing identifier)
Button("Login") { ... }

// AFTER (with identifier)
Button("Login") { ... }
    .accessibilityIdentifier("loginButton")

If triage identified an app bug (element not in UI): Skip to Phase 7 — report the missing element as an app issue. Do not modify test code.

Timeout Fix

swift
// BEFORE (might timeout)
XCTAssertTrue(element.exists)

// AFTER (explicit wait)
XCTAssertTrue(element.waitForExistence(timeout: 10))

Not Hittable Fix

swift
// BEFORE (might be obscured)
button.tap()

// AFTER (wait for hittable)
let predicate = NSPredicate(format: "isHittable == true")
let expectation = XCTNSPredicateExpectation(predicate: predicate, object: button)
_ = XCTWaiter.wait(for: [expectation], timeout: 5)
button.tap()

// Or dismiss keyboard first
if app.keyboards.count > 0 {
    app.toolbars.buttons["Done"].tap()
}

Race Condition Fix

swift
// BEFORE (race condition)
button.tap()
XCTAssertTrue(resultLabel.exists)

// AFTER (wait for result)
button.tap()
XCTAssertTrue(resultLabel.waitForExistence(timeout: 5))

Phase 5: Apply Fixes

  1. Show proposed change to user
  2. Get confirmation before editing
  3. Apply edit using Edit tool
  4. Log the change for verification
markdown
## Proposed Fix

**File**: `LoginTests.swift:47`
**Issue**: Missing waitForExistence before tap
**Change**:
```diff
- loginButton.tap()
+ XCTAssertTrue(loginButton.waitForExistence(timeout: 5))
+ loginButton.tap()

Shall I apply this fix?


## Phase 6: Verify Fix

```bash
# Re-run ONLY the failing test
xcodebuild test \
  -scheme "<SCHEME_NAME>UITests" \
  -destination "platform=iOS Simulator,id=$BOOTED_UDID" \
  -resultBundlePath "/tmp/verify-$(date +%s).xcresult" \
  -only-testing:"<TARGET>/<TestClass>/<testMethod>"

# Check result
xcrun xcresulttool get test-results summary --path /tmp/verify-*.xcresult

Phase 7: Report

markdown
## Test Debugging Complete

### Original Failures
- [TestClass/testMethod]: [original error]

### Fixes Applied
1. **LoginTests.swift:47** — Added waitForExistence before tap
2. **ProfileTests.swift:23** — Added accessibilityIdentifier "profileButton"

### Verification
- **Rerun Result**: ✅ PASS (2/2 tests)
- **Duration**: 45s (was 60s with failures)

### Remaining Issues
- None (all tests passing)

### Recommendations
1. Add accessibilityIdentifier to all interactive elements
2. Always use waitForExistence before interactions
3. Consider adding test helpers for common patterns

Decision Tree

User reports test failure
↓
Run test with result bundle
↓
Check result:
├─ Build failed → Delegate to build-fixer agent
├─ Tests passed → Report success
└─ Tests failed:
    ├─ Check for .ips crash artifacts → run xcsym crash --format=summary FIRST
    │   └─ pattern_tag guides the fix (see Phase 3: "Did the Test Crash?")
    ├─ Export failure attachments
    ├─ Read failure screenshot FIRST (multimodal analysis)
    ├─ Analyze error pattern:
    │   ├─ Element not found:
    │   │   ├─ Screenshot shows element → Fix test query/identifier
    │   │   └─ Screenshot missing element → Search app source
    │   │       ├─ Not implemented → Report: app needs this element
    │   │       └─ Wrong view/conditional → Report: app code bug
    │   ├─ Timeout → Check wait/timeout values
    │   ├─ Not hittable → Check for obscuring elements
    │   └─ State mismatch → Check for race conditions
    ├─ Read test source code
    ├─ Suggest specific fix
    ├─ Get user approval
    ├─ Apply fix
    └─ Re-run test (loop back if still failing)

Integration with Other Skills

When analyzing failures, consider:

  • axiom-testing: Best practices for element queries, waiting, condition-based waiting patterns
  • axiom-concurrency: Async test patterns, race conditions
  • axiom-swiftui: View update issues in UI tests

Guidelines

  1. Always export attachments - Screenshots are invaluable
  2. Read screenshots - You're multimodal, analyze them
  3. One fix at a time - Don't batch multiple changes
  4. Verify each fix - Re-run after each change
  5. Get user confirmation - Before editing code
  6. Max 3 iterations - If still failing, escalate to user
  7. Log all changes - For audit trail

Never:

  • Apply fixes without analyzing the failure first
  • Edit code without user confirmation
  • Skip the verification re-run after a fix
  • Batch multiple fixes before verifying each one works
  • Continue beyond 3 failed iterations without escalating

Error Quick Reference

SymptomQuick CheckLikely Fix
"Failed to find element"Screenshot shows element?YES: Add identifier. NO: Check app source — element may not exist
"Timed out"Check app loadingIncrease timeout or optimize
"Not hittable"Keyboard visible?Dismiss keyboard
"Multiple matches"Generic query?Use specific identifier
"Test hangs"Infinite wait?Add timeout, check deadlock

Resources

WWDC: 2019-413, 2025-344

Skills: axiom-testing, axiom-tools (skills/xcsym-ref.md)

Related

For test execution: test-runner agent For simulator issues: simulator-tester agent For build issues: build-fixer agent

Invocation Examples

Prompts that should launch this agent:

Explicit command: Users can also invoke this agent directly with axiom-run-tests (for debugging, specify the failing test)

Scope

Combines test-runner with intelligent failure analysis using screenshots, logs, and pattern recognition.

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Axiom Debug Tests?

Use this agent for closed-loop test debugging - automatically analyzes test failures, suggests fixes, and re-runs tests until passing.

Firwat Axiom Debug Tests op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Axiom Debug Tests besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Axiom Debug Tests an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/CharlesWiltgen/Axiom/tree/main/axiom-codex/skills/axiom-debug-tests an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Axiom Debug Tests benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Axiom Debug Tests benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Axiom Debug Tests domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Axiom Debug Tests gratis?

Jo. De Skill gëtt vum CharlesWiltgen ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇