integration-testing
Skill104 starsChanged 2 months agoMITView on GitHub
Use when setting up, running, or debugging integration tests against real Apple Mail. Also use when unit tests pass but behavior seems wrong, when adding new AppleScript operations, or when you need to understand why mocked tests are insufficient for this project.
12 other projects use a version of this.
Adopted by
Most recently taken up by
- lengrufeng2008/dsh-skill-librarytheir own version, first seen Nov 15, 2026
- Wade-DevCode/awesome-coding-skills-cntheir own version, first seen Nov 8, 2026
- s-morgan-jeffries/omnifocus-mcptheir own version, first seen Nov 8, 2026
- DevelopersGlobal/ai-agent-skillstheir own version, first seen Oct 25, 2026
- Ronnasayd/aipptheir own version, first seen Oct 20, 2026
- mejbaurbahar/software-tester-skillstheir own version, first seen Oct 13, 2026
Used with
Projects with it also use error-handling.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
MicrosoftSkillerror-handling
统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。
Also in 3 projects that use this
Other versions12 projects use a version of this.
Word for word · 1
- s-morgan-jeffries/apple-mail-fast-mcp★ 103100% same
Edited · 0
None found.
Wrote their own version · 11
- DevelopersGlobal/ai-agent-skills★ 216same name
- kid-sid/claude-spellbook★ 190same name
- elastic/integration-skills★ 16same name
- s-morgan-jeffries/omnifocus-mcp★ 8same name
- Wade-DevCode/awesome-coding-skills-cn★ 7same name
- zyggy-org/zyggy★ 2same name
- caseyng/Claude-skills★ 1same name
- mejbaurbahar/software-tester-skills★ 1same name
- Ronnasayd/aipp★ 1same name
- lengrufeng2008/dsh-skill-library★ 0same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- api-designSkill
- applescript-mailSkill
- performance-patternsSkill
- releaseSkill
The file
Files
Apple Mail Integration Testing
Why Integration Tests Matter
Unit tests mock _run_applescript() and test Python logic only. They CANNOT catch:
- AppleScript syntax errors
- Variable naming conflicts in AppleScript
- Mail.app API behavior differences between versions
- Silently-dropped record keys from NSJSONSerialization (e.g.,
name,id,sizeselector collisions) - Gmail-specific behavior differences
- Timeout issues with real mailbox sizes
The OmniFocus project's story: A variable naming typo went undetected by 400+ unit tests because they all mocked the AppleScript boundary. Only integration tests against the real app caught it. This lesson applies equally to Apple Mail.
Three-Tier Testing Strategy
| Tier | Speed | What it catches | When to run |
| Unit (mocked) | ~1s, 99 tests | Python logic, parsing, validation | Every change |
| Integration (real) | ~30s | AppleScript bugs, Mail.app quirks | New AppleScript code |
| E2E (full MCP) | ~30s | Tool registration, parameter passing | New/modified tools |
Setting Up Integration Tests
Prerequisites
- Apple Mail configured with at least one account
- macOS Automation permission granted to Terminal/IDE
Test Account Setup
# Set test account (default: "Gmail")
export MAIL_TEST_ACCOUNT="Gmail"
# Run integration tests
make test-integrationRunning Tests
# Integration tests are opt-in
pytest tests/integration/ --run-integration -v
# Or via Makefile
make test-integrationWriting Integration Tests
import pytest
from apple_mail_fast_mcp.mail_connector import AppleMailConnector
# Skip unless explicitly enabled
pytestmark = pytest.mark.skipif(
"not config.getoption('--run-integration')",
reason="Integration tests disabled by default."
)
class TestMailIntegration:
@pytest.fixture
def connector(self) -> AppleMailConnector:
return AppleMailConnector()
@pytest.fixture
def test_account(self) -> str:
import os
return os.getenv("MAIL_TEST_ACCOUNT", "Gmail")
def test_list_mailboxes(self, connector, test_account):
"""Verify we can list mailboxes from a real account."""
result = connector.list_mailboxes(test_account)
assert isinstance(result, list)
assert len(result) > 0
# INBOX should always exist
assert any("INBOX" in mb for mb in result)
@pytest.mark.skip(reason="Sends real email - enable manually")
def test_draft_send_now(self, connector):
"""Test sending a draft - enable manually only."""
...Key Patterns
Never Auto-Run Destructive Tests
# Destructive operations (send, delete, move) should be:
# 1. Skipped by default
# 2. Require explicit --run-integration flag
# 3. Require MAIL_TEST_ACCOUNT environment variable
# 4. Target a specific test account, never "all accounts"Test Account Configuration
@pytest.fixture
def test_account(self) -> str:
"""Configurable test account - never hardcode."""
import os
return os.getenv("MAIL_TEST_ACCOUNT", "Gmail")Cleanup After Tests
# If test creates data (mailbox, flag), clean up in fixture teardown
@pytest.fixture
def test_mailbox(self, connector, test_account):
name = f"MCP-Test-{uuid.uuid4()}"
connector.create_mailbox(test_account, name)
yield name
try:
# Cleanup - don't fail if already deleted
connector.delete_mailbox(test_account, name)
except Exception:
passHard Rule
If you wrote or modified AppleScript in mail_connector.py, integration tests must cover that operation before merge.
This is not optional. This is not "nice to have." Unit tests with mocked _run_applescript() give false confidence about AppleScript correctness.
Common Integration Test Failures
- "Not authorized to send Apple events" — Grant Automation permission in System Settings > Privacy & Security > Automation
- Account not found — Verify
MAIL_TEST_ACCOUNTmatches an actual configured account name in Mail.app - Timeout — Large mailboxes may exceed 60s default. Use
AppleMailConnector(timeout=120) - Gmail behavior — Gmail move/delete may behave differently than IMAP accounts. Test both if possible.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

