Test Suite
Integration tests for the gammaray-mcp bridge, written in Python using pytest. Tests communicate with the bridge over stdio JSON-RPC (the same protocol MCP clients use), exercising every tool end-to-end against a real GammaRay probe.
Prerequisites
- The bridge must be built:
cmake --build bridge/build pytest(install viapip3 install pytestorpip install pytestin a venv)- For probe-dependent tests: a QML test app at
~/Sources/testqml/relayout.qml(configurable viaTEST_QMLenv)
Running
# From the project root:
./tests/run_tests.sh --no-probe # unit tests only (no probe needed)
./tests/run_tests.sh -v # full suite, verbose
./tests/run_tests.sh -k "item" # run only item-related tests
./tests/run_tests.sh --no-probe -x # stop on first failure, no probe
Or directly with pytest:
cd tests
LD_LIBRARY_PATH=../install-prefix/lib \
QT_QPA_PLATFORM=offscreen \
QT_PLUGIN_PATH=../bridge/build/lib/x86_64-linux-gnu/qt6/plugins \
pytest -v
Test files
| File | Tests | Probe required |
|---|---|---|
test_connection.py |
connectProbe, probeStatus, disconnectProbe, reconnect |
Yes (except test_tools_listed, test_probe_status_disconnected) |
test_navigation.py |
listQuickWindows, selectQuickWindow, listQuickItems, listScenegraphNodes |
Yes |
test_items.py |
selectQuickItem, getItemProperties, position, visual properties, groups |
Yes |
test_scenegraph.py |
selectScenegraphNode, getNodeVertices, getNodeAdjacency, getMaterialShaders, getMaterialProperties, setRenderMode, setSlowMode |
Yes |
Markers
@pytest.mark.probe— test requires a running GammaRay probe. Automatically skipped with--no-probe.
Fixtures
bridge— freshMcpClientinstance per test (initialized, not connected)connected_bridge— bridge connected to a probe (viaconnectProbeDefault)probe_process— session-scoped, starts a probe viasystemd-run(fallback: direct spawn) and waits forready()
Options
| Flag | Default | Description |
|---|---|---|
--no-probe |
false |
Skip all probe-dependent tests |
--probe-timeout |
15s | Seconds to wait for probe to become ready |