Skip to main content

स्वचालित iOS ऐप परीक्षण

Synapse + Computer Control API का उपयोग Simulator के माध्यम से iOS ऐप परीक्षण स्वचालित करने के लिए।


स्वचालित iOS ऐप परीक्षण

LLM-चालित iOS ऐप परीक्षण बनाने के लिए Synapse की मेमोरी प्रणाली को Computer Control API के साथ जोड़ें। LLM परीक्षण परिदृश्यों को याद रखता है, पिछली विफलताओं से सीखता है, और UI परिवर्तनों के अनुसार ढल जाता है।

आर्किटेक्चर

┌──────────────┐    commands    ┌──────────────┐    screenshots    ┌──────────────┐
│  LLM Agent   │ ─────────────▶│  Synapse     │ ────────────────▶ │  iOS Sim     │
│  (Claude)    │               │  Computer    │ ◀──────────────── │  (via agent) │
└──────────────┘               │  Control     │    results        └──────────────┘
       │                       └──────────────┘
       │ store/recall
       ▼
┌──────────────┐
│  Memories    │ (test scenarios, past failures, UI patterns)
└──────────────┘

पूर्वापेक्षाएँ

  • Synapse खाता + Mind Key
  • Claude Desktop में Synapse MCP server कॉन्फ़िगर किया गया
  • screen-remote-agent इंस्टॉल के साथ iOS Simulator
  • Synapse में पंजीकृत कंप्यूटर (Computer Control API देखें)

चरण 1: Simulator कंप्यूटर पंजीकृत करें

iOS Simulator चलाने वाले Mac पर:

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

चरण 2: मेमोरी में परीक्षण परिदृश्य स्टोर करें

पुनः प्रयोज्य परीक्षण परिदृश्यों को मेमोरीज़ के रूप में स्टोर करें:

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

चरण 3: LLM-चालित परीक्षण निष्पादन

Claude Desktop में (Synapse MCP कॉन्फ़िगर के साथ):

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 करेगा:

  1. test_scenario_login_flow मेमोरी खोजने के लिए memory_search कॉल करेगा
  2. वर्तमान स्थिति देखने के लिए computer_screenshot कॉल करेगा
  3. प्रत्येक चरण को computer_command_queue (click, type) के माध्यम से निष्पादित करेगा
  4. स्क्रीनशॉट के माध्यम से परिणाम सत्यापित करेगा
  5. किसी भी विफलताओं को mistake मेमोरीज़ के रूप में स्टोर करेगा

चरण 4: स्व-उपचार परीक्षण

जब कोई परीक्षण विफल हो, तो विफलता और उपचार स्टोर करें:

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.")

अगली बार LLM परीक्षण चलाने पर, यह विफलता को रिकॉल करता है और उपचार स्वचालित रूप से लागू करता है।

चरण 5: परीक्षण परिणाम ट्रैकिंग

परीक्षण रन को कार्य के रूप में ट्रैक करें:

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"
        })

सामान्य कमांड्स

क्रिया कमांड
Simulator लॉन्च करें xcrun simctl launch booted com.example.app
स्क्रीनशॉट computer_screenshot (Synapse MCP के माध्यम से)
(x,y) पर टैप computer_command_queue {type:"click", payload:{x,y}}
टेक्स्ट टाइप करें computer_command_queue {type:"type", payload:{text:"..."}}
Home दबाएँ computer_command_queue {type:"key", payload:{keys:["Cmd","Shift","H"]}}

सर्वोत्तम प्रथाएँ

अगले कदम