Skip to main content

Automated unit test generator for embedded C, C++, Python, and assembly

Project description

TestForge

Stop writing unit tests by hand.

TestForge reads your embedded C, C++, Python, and assembly source files and generates ready-to-compile unit test files for Unity (primary), CppUTest, or Google Test. It extracts function signatures, detects hardware-dependent calls, inserts boundary-value test cases, and produces stubs so your tests compile without the full hardware or RTOS.

No more hand-written boilerplate that rots the first time the HAL changes. Run testforge report to see what it finds, then testforge generate to get the first draft of tests in seconds.


Quick Start

# Install (requires Python 3.10+ for now; standalone binaries after launch)
git clone https://github.com/tommy0x2a/TestForge.git
cd TestForge
pip install -e ".[dev]"

# One-time project setup (downloads Unity + creates build files)
testforge init

# See what functions are in a file
testforge report -i test_data/blink.c

Or launch the GUI:

testforge gui

Actual output:

TestForge Report - 2026-06-02 21:56:57
========================================
Parsed 1 file(s) | Skipped 0 | Functions: 4 | Warnings: 0

Functions found:
  1. SystemClock_Config(void) -> void  [line 3-5]
  2. GPIO_Init(GPIO_TypeDef GPIOx, GPIO_InitTypeDef GPIO_Init) -> void  [line 7-9]
  3. delay_ms(uint32_t ms) -> void  [line 11-13]
  4. main(void) -> int  [line 15-23]

Warnings (0): none

Run 'testforge generate' to produce test files.
# Generate Unity tests (writes tests/blink_test.c and blink_test.h)
testforge generate -i test_data/blink.c

What TestForge generates

From test_data/blink.c, testforge generate produces (excerpt — one test function shown verbatim):

/**
 * Test: delay_ms
 * Lines: 11–13 in blink.c
 */
void test_delay_ms(void) {
    /* --- Arrange --- */
    /* Boundary values for 'ms' (uint32_t): 0, 1, 4294967295UL */
    uint32_t ms = 0;
    /* --- Act --- */
    delay_ms(ms);
    /* --- Assert --- */
    /* No return value to assert — verify behavior via side effects or stubs */
    TEST_PASS();
}

Full file also includes setUp/tearDown, a main() runner, and hardware stubs for functions flagged as I/O dependent. The generated tests compile but are starting points — an engineer reviews and strengthens assertions before committing.


Supported languages

Language Parser Output Frameworks Status
C tree-sitter + libclang Unity (primary), CppUTest, Google Test Complete (M3)
C++ tree-sitter + libclang Unity, CppUTest, Google Test Complete (M3)
Python tree-sitter Unity, CppUTest, Google Test Complete (M3)
ARM Assembly custom boundary + register scan Unity (register comments) Complete (M4)

All parsers and the Unity formatter are covered by the test suite. CppUTest and Google Test formatters exist and produce compilable output but have received less battle-testing than Unity.


AI Assistant Integration (MCP)

TestForge™ exposes its full engine as MCP tools — Claude, Cursor, and Grok can discover functions, generate tests, and run constraint plans directly inside your AI coding session.

Setup: See docs/mcp_setup.md
Available on: Smithery


AI Assistant Integration (MCP)

TestForge™ exposes its full engine as MCP tools — Claude, Cursor, and Grok can discover functions, generate tests, and run constraint plans directly inside your AI coding session.

Setup: See docs/mcp_setup.md
Available on: Smithery


Pricing

  • 30-day free trial — full features, no restrictions, no telemetry, air-gap friendly after activation.
  • Individual license: $149 one-time
  • Team license (5 seats): $499 one-time

Purchase at myattech.com (storefront live after GitHub release). License keys are RSA-PSS signed and verified locally — works in air-gapped labs.


Why not [competitor]?

  • VectorCAST / Tessy: $10,000–$50,000 per seat. Overkill for teams that just need fast unit test scaffolding on a handful of modules.
  • Unity / CppUTest / Google Test by hand: Excellent frameworks. Still require you to write every test function, every boundary case, and every hardware stub yourself. TestForge feeds those frameworks.
  • GitHub Copilot / general LLMs: Helpful for boilerplate in application code. Weak on embedded specifics (volatile registers, HAL call sites, assembly, deterministic boundary values, and the exact include/stub patterns your project needs). No air-gap option and no reproducible local license model.

TestForge is narrow and deep: it does one job for one audience and does it offline.


License

Proprietary software from Myattech, LLC.
30-day fully-featured trial included.
Commercial use requires a purchased license key.
See myattech.com for current terms and 30-day money-back guarantee.


Roadmap

Completed (Phase 1 — Garage):

  • M1: C parser (tree-sitter + libclang)
  • M2: Unity test generator + boundary values + hardware stubs
  • M3: C++ and Python parsers + formatters
  • M4: ARM assembly function boundary + register sequence extraction
  • M5: Local RSA-PSS licensing (trial + paid keys), license subcommands, air-gap support
  • M6–M8: Packaging, GUI foundations, path mirroring, init command, header generation
  • M9: Boundary explosion, guard detection, multi-vendor isolation, pytest output
  • M10: Bidirectional constraint test plans (--with-plan / --plan), Option C protection, full IP/trademark injection
  • M11: End-to-end compilable builds (BlinkApp): source isolation wrappers, per-app CMakeLists, VSCode debug launch.json/tasks, meaningful pre-annotated plans
  • M12: Discovery → Curation → Execution (DCE) workflow — testforge discover, live testforge run --plan with constraints/stress/mocks, MockBackend + SerialBackend (socat loopback), PlanRunner + rich reports, mock_valid_struct + ctypes struct/buffer simulation for training, canonical SerialApp example with fully annotated plan. All prior tests unbroken.

Current capabilities (beyond original M6 launch vision):

  • Full static test generation for C/C++/Python/ASM → Unity (primary) + other frameworks
  • Compilable test binaries with source wrappers + debuggable in VSCode (no manual edits)
  • Powerful live constraint execution engine (DCE) for validation, demos, and "spec-driven" testing of HAL/drivers
  • 30-day air-gap trial + local license validation

Future (post first customers / Phase 2+):

  • macOS binary + notarization
  • GUI integration for plan curation + one-click DCE runs
  • Real shared-lib execution path for C functions in run
  • CI-friendly report artifacts + more backends
  • Additional assembly architectures; RegisterGen companion tool

No vaporware. The committed code and passing test suite are the source of truth. The DCE live runner + SerialApp is the recommended way to experience the full power of the constraint + mock system.


Contact

Bugs, surprising parse results, and "it generated X but I needed Y" reports are all welcome. This tool is built by one embedded engineer who got tired of writing the same tests.


Built by Myattech, LLC — bootstrapped developer tools for people who ship firmware.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

testforge_unittest-0.1.1.tar.gz (120.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

testforge_unittest-0.1.1-py3-none-any.whl (115.1 kB view details)

Uploaded Python 3

File details

Details for the file testforge_unittest-0.1.1.tar.gz.

File metadata

  • Download URL: testforge_unittest-0.1.1.tar.gz
  • Upload date:
  • Size: 120.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for testforge_unittest-0.1.1.tar.gz
Algorithm Hash digest
SHA256 defbf6dde55041976f4b4360303eab9648fea68634fdd45adfc75e84ac3014f6
MD5 3b17d7840b046e9c4c56ea3e2de06467
BLAKE2b-256 46a4825dc6414d21b97875eafb6832e71ceeaf29c176df130720fc329ae35eef

See more details on using hashes here.

File details

Details for the file testforge_unittest-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for testforge_unittest-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31bfdadef29bae93bded3f129f8c1decd169af6c738b7f40604e9ed00d8b6011
MD5 5a46051779521d8923b3c60926793f3d
BLAKE2b-256 6c5810af41eb3488c30df81f114c887b157bb0649b91f2bf087315e7b5d7370d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page