Geautomatiseerde iOS-app-testen
Gebruik Synapse + Computer Control API om iOS-app-tests te automatiseren via Simulator.
Geautomatiseerde iOS-app-testen
Combineer het memory-systeem van Synapse met de Computer Control API om door LLM aangedreven iOS-app-tests te bouwen. De LLM herinnert testscenario's, leert van eerdere fouten, en past zich aan UI-wijzigingen aan.
Architectuur
┌──────────────┐ commands ┌──────────────┐ screenshots ┌──────────────┐
│ LLM Agent │ ─────────────▶│ Synapse │ ────────────────▶ │ iOS Sim │
│ (Claude) │ │ Computer │ ◀──────────────── │ (via agent) │
└──────────────┘ │ Control │ results └──────────────┘
│ └──────────────┘
│ store/recall
▼
┌──────────────┐
│ Memories │ (test scenarios, past failures, UI patterns)
└──────────────┘Vereisten
- Synapse-account + Mind Key
- Synapse MCP-server geconfigureerd in Claude Desktop
- iOS Simulator met
screen-remote-agentgeïnstalleerd - Computer geregistreerd in Synapse (zie Computer Control API)
Stap 1: Registreer de Simulator-computer
Op de Mac waarop iOS Simulator draait:
# Get install code from Synapse
curl -X POST https://synapse.schaefer.zone/computers/install-code \
-H "Authorization: Bearer YOUR_MIND_KEY" \
-d '{"computer_name":"ios-sim"}'
# → { "install_code": "ic_..." }
# Run screen-remote-agent on the Mac
# (uses the install code to register)Stap 2: Sla testscenario's op in memory
Sla herbruikbare testscenario's op als herinneringen:
import requests
def store_test_scenario(name, steps, app):
requests.post(f"{URL}/memory",
headers={"Authorization": f"Bearer {MIND_KEY}"},
json={
"category": "skill",
"key": f"test_scenario_{name}",
"content": f"App: {app}\nSteps:\n" + "\n".join(steps),
"tags": ["test", "ios", app],
"priority": "high"
})
store_test_scenario("login_flow", [
"Launch app",
"Tap email field",
"Type test@example.com",
"Tap password field",
"Type password123",
"Tap Login button",
"Verify home screen appears"
], "MyApp")Stap 3: Door LLM aangedreven testuitvoering
In Claude Desktop (met Synapse MCP geconfigureerd):
Run the login_flow test scenario on the iOS Simulator.
Take a screenshot after each step and verify the expected UI.
If any step fails, store the failure as a memory so we can
avoid it next time.Claude zal:
memory_searchaanroepen om detest_scenario_login_flow-herinnering te vindencomputer_screenshotaanroepen om de huidige staat te zien- Elke stap uitvoeren via
computer_command_queue(klik, typ) - Resultaten verifiëren via schermafbeeldingen
- Eventuele fouten opslaan als
mistake-herinneringen
Stap 4: Zelfherstellende tests
Wanneer een test faalt, sla de fout en het herstel op:
def store_test_failure(scenario, step, error, recovery):
requests.post(f"{URL}/memory",
headers={"Authorization": f"Bearer {MIND_KEY}"},
json={
"category": "mistake",
"key": f"failure_{scenario}_{step}",
"content": f"Scenario: {scenario}\nStep: {step}\nError: {error}\nRecovery: {recovery}",
"tags": ["test", "failure", "ios", scenario],
"priority": "high"
})
# Example
store_test_failure("login_flow", "tap_login",
"Login button not found at expected coordinates",
"Button moved due to new logo. Search by accessibility label instead.")De volgende keer dat de LLM de test uitvoert, haalt hij de fout op en past hij het herstel automatisch toe.
Stap 5: Testresultaat-tracking
Volg testruns als taken:
def track_test_run(scenario, status, duration):
requests.post(f"{URL}/mind/task",
headers={"Authorization": f"Bearer {MIND_KEY}",
"Content-Type": "application/json"},
json={
"title": f"Test: {scenario}",
"description": f"Status: {status}, Duration: {duration}s",
"priority": "normal"
})Veelvoorkomende commando's
| Actie | Commando |
|---|---|
| Simulator starten | xcrun simctl launch booted com.example.app |
| Schermafbeelding | computer_screenshot (via Synapse MCP) |
| Tik op (x,y) | computer_command_queue {type:"click", payload:{x,y}} |
| Typ tekst | computer_command_queue {type:"type", payload:{text:"..."}} |
| Druk op Home | computer_command_queue {type:"key", payload:{keys:["Cmd","Shift","H"]}} |