Fossil Test is a comprehensive unit testing, mocking, and benchmarking suite created by Fossil Logic, designed to ensure the reliability and performance of C and C++ projects. With support for multiple development methodologies, including Behavior-Driven Development (BDD), Domain-Driven Design (DDD), and Test-Driven Development (TDD), Fossil Test provides a versatile foundation for crafting high-quality test cases across various workflows.
The Fossil suite consists of three complementary frameworks to streamline the development and testing process:
- Fossil Test: The core unit testing framework that enables developers to create, manage, and execute unit tests effectively, ensuring each component functions as expected.
- Fossil Mock: A dedicated mocking library that simulates complex dependencies. Using mock objects, developers can isolate and thoroughly test individual components, improving the precision and reliability of test coverage.
- Fossil Mark: A benchmarking tool that provides detailed performance insights by measuring execution time, identifying bottlenecks, and offering in-depth reporting to optimize code efficiency.
Together, Fossil Test, Fossil Mock, and Fossil Mark offer a powerful, integrated toolkit for developing, testing, and optimizing robust software, making them an essential asset for developers committed to quality and performance.
Key Features:
Feature | Description |
---|---|
BDD, DDD, and TDD Support | Supports Behavior-Driven, Domain-Driven, and Test-Driven Development styles, catering to various project methodologies. |
Comprehensive Unit Testing | A full suite of tools for creating, managing, and executing unit tests, ensuring that individual units of code behave as expected. |
Mocking Capabilities | Powerful mocking features allow developers to simulate complex dependencies, ensuring focused and reliable unit tests. |
Performance Tracking | Measures and reports the performance of each test case, helping developers optimize test execution time and performance. |
Command-Line Interface (CLI) | A powerful CLI for running tests, generating reports, and managing the test suite, supporting automation and integration workflows. |
To get started with Fossil Test, ensure you have the following installed:
- Meson Build System: Fossil Test requires Meson. If you don’t have Meson installed, follow the installation instructions on the official Meson website.
To integrate Fossil Test into your project, follow these steps:
-
Install Meson Build System: Install Meson version
1.3
or newer:python -m pip install meson # To install Meson python -m pip install --upgrade meson # To upgrade Meson
-
Create a
.wrap
File: Add thefossil-test.wrap
file in yoursubprojects
directory and include the following content:# ====================== # Git Wrap package definition # ====================== [wrap-git] url = https://github.com/fossillogic/fossil-test.git revision = v1.1.3 [provide] fossil-test = fossil_test_dep
-
Integrate the Dependency: In your
meson.build
file, integrate Fossil Test by adding the following line:dep = dependency('fossil-test')
Note: For the best experience, always use the latest release of Fossil Test. Visit the Fossil Test Releases page for the latest versions.
The Fossil Test CLI provides an efficient way to run and manage tests directly from the terminal. Here are the available commands and options:
Command | Description |
---|---|
--version |
Displays the current version of Fossil Test. |
--help |
Shows help message with usage instructions. |
--info |
Displays detailed information about the test run. |
reverse [enable/disable] |
Enables or disables reverse order of test execution. |
repeat=<number> |
Repeats the test suite a specified number of times. |
shuffle [enable/disable] |
Enables or disables shuffling of test execution order. |
-
Display the version:
fossil_cli --version
-
Enable reverse order of test execution:
fossil_cli reverse enable
-
Repeat the test suite 5 times:
fossil_cli repeat=5
To configure the build system with testing enabled, use the following command:
meson setup builddir -Dwith_test=enabled
If you would like to contribute, have questions, or need help, feel free to open an issue on the Fossil Test GitHub repository or consult the Fossil Logic Docs.
Fossil Test is a powerful and flexible framework for C and C++ developers, designed to support a wide range of testing methodologies such as BDD, DDD, and TDD. With features like mocking, detailed reporting, and performance tracking, Fossil Test empowers developers to create high-quality software and maintainable test suites. Combined with Fossil Mark and Fossil Mock, it provides a complete suite for testing, optimization, and dependency management. Whether you're building small projects or large-scale applications, Fossil Test is an essential tool to ensure the reliability and performance of your code.