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.
Table of Contents
- π Installation
- π¦ Dependencies
- π Tool structure
- π Code coverage
- π Usage
- π Docs
- π₯ Contributing
- π Copyright and licence
Used next development environment
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
gen_um_test is located at pypi.org.
You can install by using pip
# python3
pip3 install gen_um_testNavigate 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.pyNavigate 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_infoYou can use Dockerfile to create image/container.
gen_um_test requires next modules and libraries
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- 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.txtbuild scripts integrated with GoogleTest and GoogleMock. - Configurable template engine structured in
templates.tgzwithscheme.jsonschema 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.
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% |
Install package
pip3 install gen_um_testPrepare 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.pyRunning tool for generating complete GoogleTest suite:
python3 main.py suite --interface include/ISerialPort.h --output ./tests --prefix commRunning 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 ./testsMore documentation and info at
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.



