← API Guide / Verification and testing

Verification and testing

Separate Python, local protocol and real CAD-engine tests; understand what each proves.

1. Offline Python and local socket tests

.\scripts\test.ps1
# Or:
python -m unittest discover -s tests -p "test_*.py" -v

These verify the Script data contract, CLI arguments, JSON round-trips and fake authenticated localhost socket exchanges for engine.describe and engine.batch. The fake endpoint tests only the wire protocol; it does not create or inspect CAD geometry.

2. Run the real native SolidCraft engine

.\scripts\test.ps1 -Native
# Or, with solidcraft-cli 0.30.1 installed:
python tests/native_smoke.py --output-dir output/native-smoke

The native test checks the installed version and command registry, exports the Python Plate, runs it headlessly, opens its saved editable .sc container and evaluates its body and feature history. It independently replays the exported JSON and checks that both results have matching bounding boxes and timeline length. An intentionally invalid command must be rejected.

The expected Plate is one body measuring 100 × 60 × 10 mm, with an error-free native feature timeline.

3. Continuous integration

GitHub Actions runs the Python/socket suite on Linux, the documented PowerShell entry point on Windows and an actual checksum-verified SolidCraft 0.30.1 native CLI run. The CAD repository also compares independently authored SCPF and SCPC models. The Pages site is published only after the library's required CI jobs succeed.

4. The desktop GUI still needs manual inspection

Automated protocol tests do not prove an open GUI accepts a live request or that a feature is displayed as intended. For live testing, open an empty design, enable the Assistant connection, execute a known example with --connect, and inspect its bodies and feature tree.

Principle: Valid Python is not necessarily valid SolidCraft JSON; valid JSON is not necessarily a successful native command; successful commands do not by themselves prove the intended geometry.