Skip to main content

Generate GoogleTest/GoogleMock Test Suites for C++ Interfaces

gen_um_test is a toolset for automatic generation of GoogleTest and GoogleMock test suites from C++ pure virtual interface headers.

Developed in python code.

The README is used to introduce the modules and provide instructions on how to install the modules, any machine dependencies it may have and any other information that should be provided before the modules are installed.

gen_um_test python checker gen_um_test package checker gen_um_test interface checker gen_um_test isp checker gen_um_test srp checker GitHub issues open GitHub contributors

Table of Contents

🚀 Installation

Used next development environment

debian linux os

gen_um_test python3 build

Currently there are three ways to install package

  • Install process based on using pip mechanism
  • Install process based on build mechanism
  • Install process based on setup.py mechanism
  • Install process based on docker mechanism
Install using pip

gen_um_test is located at pypi.org.

You can install by using pip

# python3
pip3 install gen_um_test
Install using build

Navigate to release page download and extract release archive.

To install gen_um_test type the following

tar xvzf gen_um_test-x.y.z.tar.gz
cd gen_um_test-x.y.z/
# python3
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py 
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
pip3 install -r requirements.txt
python3 -m build --no-isolation --wheel
pip3 install ./dist/gen_um_test-*-py3-none-any.whl
rm -f get-pip.py
Install using py setup

Navigate to release page download and extract release archive.

To install gen_um_test locate and run setup.py with arguments

tar xvzf gen_um_test-x.y.z.tar.gz
cd gen_um_test-x.y.z
# python3
pip3 install -r requirements.txt
python3 setup.py install_lib
python3 setup.py install_egg_info
Install using docker

You can use Dockerfile to create image/container.

📦 Dependencies

gen_um_test requires next modules and libraries

📁 Tool structure

gen_um_test is based on OOP.

Tool structure

Click to expand framework structure
    gen_um_test/
         ├── core/
         │   ├── __init__.py
         │   ├── model/
         │   │   ├── cpp_interface.py
         │   │   ├── cpp_method.py
         │   │   ├── generation_result.py
         │   │   ├── __init__.py
         │   │   └── test_suite_config.py
         │   └── service/
         │       ├── engine.py
         │       ├── icmake_generator.py
         │       ├── icpp_parser.py
         │       ├── ifake_generator.py
         │       ├── imock_generator.py
         │       ├── __init__.py
         │       ├── iservice.py
         │       ├── isubprocessor.py
         │       └── itest_generator.py
         ├── engine.py
         ├── infrastructure/
         │   ├── cli/
         │   │   ├── engine.py
         │   │   ├── icli.py
         │   │   ├── __init__.py
         │   │   └── setup/
         │   │       ├── bundle.py
         │   │       ├── dep_validator.py
         │   │       ├── dependencies.py
         │   │       ├── factory.py
         │   │       ├── __init__.py
         │   │       ├── keys.py
         │   │       ├── opt_validator.py
         │   │       ├── options.py
         │   │       ├── registry.py
         │   │       └── validator.py
         │   ├── command/
         │   │   ├── cmake_command_definition.py
         │   │   ├── cmake_command_executor.py
         │   │   ├── command.py
         │   │   ├── fake_command_definition.py
         │   │   ├── fake_command_executor.py
         │   │   ├── icommand_definition.py
         │   │   ├── icommand_executor.py
         │   │   ├── __init__.py
         │   │   ├── mock_command_definition.py
         │   │   ├── mock_command_executor.py
         │   │   ├── suite_command_definition.py
         │   │   ├── suite_command_executor.py
         │   │   ├── test_command_definition.py
         │   │   └── test_command_executor.py
         │   ├── config/
         │   │   ├── gen_um_test.cfg
         │   │   ├── gen_um_test.logo
         │   │   ├── scheme.json
         │   │   └── templates.tgz
         │   ├── generator/
         │   │   ├── cmake_generator.py
         │   │   ├── code_formatter.py
         │   │   ├── fake_generator.py
         │   │   ├── __init__.py
         │   │   ├── main_generator.py
         │   │   ├── mock_generator.py
         │   │   ├── template_provider.py
         │   │   └── test_generator.py
         │   ├── __init__.py
         │   ├── parser/
         │   │   ├── cpp_parser.py
         │   │   └── __init__.py
         │   ├── subprocessor.py
         │   └── templates/
         │       ├── cmake.template
         │       ├── fake.template
         │       ├── main.template
         │       ├── mock.template
         │       └── test.template
         ├── __init__.py
         ├── py.typed
         └── setup/
             ├── bundle.py
             ├── dep_validator.py
             ├── dependencies.py
             ├── factory.py
             ├── __init__.py
             ├── keys.py
             ├── opt_validator.py
             ├── options.py
             ├── registry.py
             └── validator.py

     13 directories, 76 files

✨ Features

  • Parses C++ pure virtual interface header files (.h / .hpp).
  • Synthesizes modern GoogleMock header mocks using MOCK_METHOD(...) with #pragma once.
  • Generates unit test suites (<interface>_test.cc), in-memory fake stubs (fake_<interface>.h), and test runners (test_main.cc).
  • Generates standalone CMakeLists.txt build scripts integrated with GoogleTest and GoogleMock.
  • Configurable template engine structured in templates.tgz with scheme.json schema validation.
  • Provides a modular and extensible architecture based on OOP, SOLID, and Hexagonal principles.
  • Includes command line interface (CLI) support via a command/executor structure.
  • High code quality with full type checking and 100% unit test coverage.

📊 Code coverage

Click to expand code coverage
Name Stmts Miss Cover
gen_um_test/__init__.py 9 0 100%
gen_um_test/core/__init__.py 9 0 100%
gen_um_test/core/model/__init__.py 9 0 100%
gen_um_test/core/model/cpp_interface.py 43 0 100%
gen_um_test/core/model/cpp_method.py 43 0 100%
gen_um_test/core/model/generation_result.py 19 0 100%
gen_um_test/core/model/test_suite_config.py 23 0 100%
gen_um_test/core/service/__init__.py 9 0 100%
gen_um_test/core/service/engine.py 42 0 100%
gen_um_test/core/service/icmake_generator.py 14 0 100%
gen_um_test/core/service/icpp_parser.py 16 0 100%
gen_um_test/core/service/ifake_generator.py 15 0 100%
gen_um_test/core/service/imock_generator.py 15 0 100%
gen_um_test/core/service/iservice.py 20 0 100%
gen_um_test/core/service/isubprocessor.py 14 0 100%
gen_um_test/core/service/itest_generator.py 15 0 100%
gen_um_test/engine.py 57 0 100%
gen_um_test/infrastructure/__init__.py 9 0 100%
gen_um_test/infrastructure/cli/__init__.py 9 0 100%
gen_um_test/infrastructure/cli/engine.py 39 0 100%
gen_um_test/infrastructure/cli/icli.py 14 0 100%
gen_um_test/infrastructure/cli/setup/__init__.py 9 0 100%
gen_um_test/infrastructure/cli/setup/bundle.py 22 0 100%
gen_um_test/infrastructure/cli/setup/dep_validator.py 36 0 100%
gen_um_test/infrastructure/cli/setup/dependencies.py 18 0 100%
gen_um_test/infrastructure/cli/setup/factory.py 49 0 100%
gen_um_test/infrastructure/cli/setup/keys.py 26 0 100%
gen_um_test/infrastructure/cli/setup/opt_validator.py 36 0 100%
gen_um_test/infrastructure/cli/setup/options.py 15 0 100%
gen_um_test/infrastructure/cli/setup/registry.py 24 0 100%
gen_um_test/infrastructure/cli/setup/validator.py 43 0 100%
gen_um_test/infrastructure/command/__init__.py 9 0 100%
gen_um_test/infrastructure/command/cmake_command_definition.py 24 0 100%
gen_um_test/infrastructure/command/cmake_command_executor.py 28 0 100%
gen_um_test/infrastructure/command/command.py 16 0 100%
gen_um_test/infrastructure/command/fake_command_definition.py 24 0 100%
gen_um_test/infrastructure/command/fake_command_executor.py 28 0 100%
gen_um_test/infrastructure/command/icommand_definition.py 14 0 100%
gen_um_test/infrastructure/command/icommand_executor.py 14 0 100%
gen_um_test/infrastructure/command/mock_command_definition.py 24 0 100%
gen_um_test/infrastructure/command/mock_command_executor.py 28 0 100%
gen_um_test/infrastructure/command/suite_command_definition.py 24 0 100%
gen_um_test/infrastructure/command/suite_command_executor.py 28 0 100%
gen_um_test/infrastructure/command/test_command_definition.py 24 0 100%
gen_um_test/infrastructure/command/test_command_executor.py 28 0 100%
gen_um_test/infrastructure/generator/__init__.py 9 0 100%
gen_um_test/infrastructure/generator/cmake_generator.py 32 0 100%
gen_um_test/infrastructure/generator/code_formatter.py 28 0 100%
gen_um_test/infrastructure/generator/fake_generator.py 57 0 100%
gen_um_test/infrastructure/generator/main_generator.py 26 0 100%
gen_um_test/infrastructure/generator/mock_generator.py 46 0 100%
gen_um_test/infrastructure/generator/template_provider.py 75 0 100%
gen_um_test/infrastructure/generator/test_generator.py 68 0 100%
gen_um_test/infrastructure/parser/__init__.py 9 0 100%
gen_um_test/infrastructure/parser/cpp_parser.py 110 0 100%
gen_um_test/infrastructure/subprocessor.py 122 0 100%
gen_um_test/setup/__init__.py 9 0 100%
gen_um_test/setup/bundle.py 23 0 100%
gen_um_test/setup/dep_validator.py 36 0 100%
gen_um_test/setup/dependencies.py 19 0 100%
gen_um_test/setup/factory.py 58 0 100%
gen_um_test/setup/keys.py 27 0 100%
gen_um_test/setup/opt_validator.py 36 0 100%
gen_um_test/setup/options.py 12 0 100%
gen_um_test/setup/registry.py 24 0 100%
gen_um_test/setup/validator.py 48 0 100%
Total 1908 0 100%

🛠 Usage

Install package

pip3 install gen_um_test

Prepare main entry point by downloading main.py or create your own.

wget -O main.py https://raw.githubusercontent.com/electux/gen_um_test/main/main.py

Running tool for generating complete GoogleTest suite:

python3 main.py suite --interface include/ISerialPort.h --output ./tests --prefix comm

Running tool for generating individual components:

python3 main.py mock --interface include/ISerialPort.h --output ./tests
python3 main.py test --interface include/ISerialPort.h --output ./tests
python3 main.py fake --interface include/ISerialPort.h --output ./tests
python3 main.py cmake --interface include/ISerialPort.h --output ./tests

📚 Docs

Documentation Status

More documentation and info at

👥 Contributing

Contributing to gen_um_test

License: GPL v3 License

Copyright (C) 2026 by vroncevic.github.io/gen_um_test

gen_um_test is free software; you can redistribute it and/or modify it under the same terms as Python itself, either Python version 3.x or, at your option, any later version of Python 3 you may have available.

Lets help and support PSF.

Python Software Foundation

Donate

Metadata

Release files for gen-um-test 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gen-um-test 1.0.2
File Size Uploaded
gen_um_test-1.0.2.tar.gz 50.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gen-um-test 1.0.2
File Interpreter ABI Platform
gen_um_test-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 165.2 kB

Release files / gen_um_test-1.0.2.tar.gz

Download URL gen_um_test-1.0.2.tar.gz
Size 50.0 kB
Tags Source
SHA-256 checksum
How to use checksums
497bb17b838f206c970970d56a5b24d4e8ff1cd0aba5d202af2b01d068dc2a66
BLAKE2b-256 checksum
How to use checksums
9c7f46088e18f24716be9a2214713953844ac6dcc061c6b8ae317fe3451d2ada
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.0 CPython/3.12.3

Release files / gen_um_test-1.0.2-py3-none-any.whl

Download URL gen_um_test-1.0.2-py3-none-any.whl
Size 115.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a306153be42b5890da9f59853d1d44113c0540d127d6f37cf3a037158e0c496e
BLAKE2b-256 checksum
How to use checksums
f3f674a5969e9ea17e6a3a68231af0c9d6d9c60d12129f2893184b907da4f66a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page