IDA Pro MCP ships a custom headless test framework that loads binaries through idalib and runs tests without opening the IDA GUI. Tests live alongside the functions they cover inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/mrexodia/ida-pro-mcp/llms.txt
Use this file to discover all available pages before exploring further.
api_*.py files and in dedicated files under src/ida_pro_mcp/ida_mcp/tests/. The test runner is invoked with uv run ida-mcp-test.
Running the test suite
Two test fixtures are maintained. Run both to get full coverage:-q flag prints failures and a summary only, suppressing per-test output.
Filtering tests
Run only the tests in a specific API module with-c:
-p:
Running a non-fixture binary
When adding generic tests, verify they are not ELF-specific by running against an unrelated binary:Measuring coverage
Measure coverage across both fixtures using thecoverage package:
Test fixtures
crackme03.elf
Compact general-purpose regression fixture. Most tests that do not require
typed data run against this binary.
typed_fixture.elf
Typed globals, structs, local variables, and stack frames. Required for
tests that exercise
api_types.py and api_stack.py code paths.Writing tests
The @test decorator
Register a test function with the @test() decorator imported from .tests:
api_core).
Binary-specific tests
Use@test(binary="...") with the executable basename when a test requires properties unique to one fixture:
Binary-specific tests run only when that exact binary is loaded. Reserve them for edge cases that cannot be triggered with generic inputs — do not use them to assert IDA-specific addresses or values.
Assertion helpers
Import helpers from.tests instead of using bare assert statements:
| Helper | What it checks |
|---|---|
assert_has_keys(d, *keys) | Dict contains all specified keys |
assert_valid_address(addr) | String is a valid 0x-prefixed hex address |
assert_non_empty(value) | Value is not None, "", or [] |
assert_is_list(value, min_length=0) | Value is a list with at least min_length items |
assert_all_have_keys(items, *keys) | Every dict in the list contains all specified keys |
Test data helpers
These helpers return valid inputs without hardcoding addresses:get_n_functions() and get_n_strings() return a deterministically sampled list whose size is controlled by the --sample-size flag (default: 5).
Test writing guidelines
Follow these conventions to keep the test suite reliable and maintainable: Prefer semantic assertions. Check that a field has the expected value or shape, not just that it exists. Weakassert "key" in result checks should be replaced with assert_has_keys plus value checks.
Use round-trip tests for mutating APIs. Restore the original state in a finally block:
get_any_function() or similar helpers return None.
Some IDA and Hex-Rays behaviors vary between IDA versions or binary types. Guarded assertions (
if hexrays_ready: ...) and @test(skip=True) are acceptable when the variance is documented and justified.Coverage targets
| Module | Target |
|---|---|
api_core | 90%+ |
api_analysis | 85%+ |
api_memory | 85%+ |
api_types | 80%+ |
api_modify | 70%+ |
api_resources | 85%+ |
api_stack | 80%+ |
api_debug | Skip — requires an active debugger |
api_python | Skip — requires special setup |