|
1 | | -# ***Fossil Test: Unit Testing/Mocking Framework*** - `C, C++` |
| 1 | +# ***Fossil Test by Fossil Logic*** |
2 | 2 |
|
3 | | -**Overview:** |
4 | | -Fossil Test is a robust unit testing and mocking framework developed by Fossil Logic. It is designed to facilitate the creation of high-quality test cases across any C and C++ project. The framework supports Behavior-Driven Development (BDD), Domain Driven Development (DDD), and Test-Driven Development (TDD) styles, providing a flexible and comprehensive solution for ensuring software reliability and correctness. |
| 3 | +**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. |
5 | 4 |
|
6 | | -In addition to Fossil Test, Fossil Logic also offers two additional frameworks: Fossil Mark and Fossil Mock. Fossil Mark is a powerful benchmarking framework that allows developers to measure the performance of their code and identify areas for optimization. With built-in timing information and detailed reporting, developers can easily track the execution time of each test case and make informed decisions to improve the efficiency of their software. |
| 5 | +The Fossil suite consists of three complementary frameworks to streamline the development and testing process: |
7 | 6 |
|
8 | | -Fossil Mock, on the other hand, provides powerful mocking capabilities that enable developers to simulate the behavior of complex dependencies. This ensures focused and reliable unit tests, as developers can create mock objects that mimic the behavior of real dependencies, allowing for thorough testing of different scenarios. |
| 7 | +- **Fossil Test**: The core unit testing framework that enables developers to create, manage, and execute unit tests effectively, ensuring each component functions as expected. |
| 8 | +- **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. |
| 9 | +- **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. |
9 | 10 |
|
10 | | -By combining the features of Fossil Test, Fossil Mark, and Fossil Mock, developers can create robust and performant code, ensuring the quality and reliability of their software projects. |
| 11 | +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. |
| 12 | + |
| 13 | +--- |
11 | 14 |
|
12 | 15 | **Key Features:** |
13 | 16 |
|
14 | 17 | | Feature | Description | |
15 | 18 | |--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------| |
16 | | -| **BDD and TDD Support** | Allows developers to write tests in both BDD and TDD styles, catering to various development and testing preferences. | |
17 | | -| **Unit Testing** | Provides a complete suite of tools for writing and executing unit tests, ensuring that individual units of code perform as expected. | |
18 | | -| **Mocking Capabilities** | Includes powerful mocking features that enable developers to simulate the behavior of complex dependencies, ensuring focused and reliable unit tests. | |
19 | | -| **Test Case Management** | Supports organizing and managing test cases efficiently, with features for categorizing, prioritizing, and tagging tests. | |
20 | | -| **Detailed Reporting** | Generates detailed reports on test execution, including information on passed, failed, skipped, and timed-out tests, helping developers quickly address issues. | |
21 | | -| **Performance Tracking** | Tracks the performance of each test case with built-in timing information, allowing developers to monitor and optimize test execution time. | |
22 | | -| **Assertion Detection** | Detects whether assertions are used within the code, ensuring that critical conditions are enforced and identifying areas that may lack proper validation. | |
23 | | -| **Command-Line Interface (CLI)** | Includes a powerful CLI for running tests, generating reports, and managing the test suite from the command line, enhancing automation and integration. | |
24 | | -| **Extensible and Configurable** | Designed to be extensible and configurable, allowing developers to tailor the framework to their specific needs, from reporting formats to tool integration.| |
| 19 | +| **BDD, DDD, and TDD Support** | Supports Behavior-Driven, Domain-Driven, and Test-Driven Development styles, catering to various project methodologies. | |
| 20 | +| **Comprehensive Unit Testing** | A full suite of tools for creating, managing, and executing unit tests, ensuring that individual units of code behave as expected. | |
| 21 | +| **Mocking Capabilities** | Powerful mocking features allow developers to simulate complex dependencies, ensuring focused and reliable unit tests. | |
| 22 | +| **Performance Tracking** | Measures and reports the performance of each test case, helping developers optimize test execution time and performance. | |
| 23 | +| **Command-Line Interface (CLI)** | A powerful CLI for running tests, generating reports, and managing the test suite, supporting automation and integration workflows. | |
| 24 | + |
| 25 | +--- |
25 | 26 |
|
26 | 27 | ## ***Prerequisites*** |
27 | 28 |
|
28 | | -Before getting started, make sure you have the following installed: |
| 29 | +To get started with Fossil Test, ensure you have the following installed: |
| 30 | + |
| 31 | +- **Meson Build System**: Fossil Test requires Meson. If you don’t have Meson installed, follow the installation instructions on the official [Meson website](https://mesonbuild.com/Getting-meson.html). |
29 | 32 |
|
30 | | -- **Meson Build System**: This project relies on Meson. If you don't have Meson installed, visit the official [Meson website](https://mesonbuild.com/Getting-meson.html) for installation instructions. |
| 33 | +--- |
31 | 34 |
|
32 | | -## Adding Dependency |
| 35 | +### Adding Fossil Test Dependency |
33 | 36 |
|
34 | | -1. **Install Meson Build System**: Before integrating the dependency, ensure you have Meson `1.3` or newer installed on your host system. You can install it with this command. |
| 37 | +To integrate Fossil Test into your project, follow these steps: |
35 | 38 |
|
| 39 | +1. **Install Meson Build System**: |
| 40 | + Install Meson version `1.3` or newer: |
36 | 41 | ```sh |
37 | | - python -m pip install meson # to install Meson |
38 | | - python -m pip install --upgrade meson # to upgrade Meson |
| 42 | + python -m pip install meson # To install Meson |
| 43 | + python -m pip install --upgrade meson # To upgrade Meson |
39 | 44 | ``` |
40 | 45 |
|
41 | | -2. **Adding Wrap File**: You can add a `.wrap` file by first navigating to the `subprojects` directory and creating `fossil-test.wrap`. Next, copy the definition into the file: |
| 46 | +2. **Create a `.wrap` File**: |
| 47 | + Add the `fossil-test.wrap` file in your `subprojects` directory and include the following content: |
42 | 48 |
|
43 | 49 | ```ini |
44 | 50 | # ====================== |
45 | 51 | # Git Wrap package definition |
46 | 52 | # ====================== |
47 | 53 | [wrap-git] |
48 | 54 | url = https://github.com/fossillogic/fossil-test.git |
49 | | - revision = v1.0.6 |
| 55 | + revision = v1.0.7 |
50 | 56 |
|
51 | 57 | [provide] |
52 | 58 | fossil-test = fossil_test_dep |
53 | | - fossil-mock = fossil_mock_dep |
54 | | - fossil-mark = fossil_mark_dep |
55 | 59 | ``` |
56 | 60 |
|
57 | | -3. **Integrate the New Dependency**: After creating the dependency `.wrap` file, you need to integrate it into your Meson project. This typically involves adding the dependency to your `meson.build` file. Here's an example of how you might do that: |
58 | | - |
| 61 | +3. **Integrate the Dependency**: |
| 62 | + In your `meson.build` file, integrate Fossil Test by adding the following line: |
59 | 63 | ```ini |
60 | 64 | dep = dependency('fossil-test') |
61 | 65 | ``` |
62 | 66 |
|
63 | | - This line retrieves the `fossil-test` dependency, allowing you to use it in your project. **Releases Page**: Head over to the [Fossil Test Releases](https://github.com/fossillogic/fossil-test/releases) to find any preferred version of the framework. For the best experience with Fossil Test, it is recommended to always use the latest release. |
| 67 | + **Note**: For the best experience, always use the latest release of Fossil Test. Visit the [Fossil Test Releases](https://github.com/fossillogic/fossil-test/releases) page for the latest versions. |
| 68 | + |
| 69 | +--- |
64 | 70 |
|
65 | 71 | ## Fossil Test CLI Usage |
66 | 72 |
|
67 | | -The Fossil Test CLI is a command-line tool designed to help you run and manage your test suite efficiently. Below are the available commands and options: |
| 73 | +The Fossil Test CLI provides an efficient way to run and manage tests directly from the terminal. Here are the available commands and options: |
68 | 74 |
|
69 | 75 | ### Commands and Options |
70 | 76 |
|
71 | 77 | | Command | Description | |
72 | | -|---------------------------------|-----------------------------------------------------------------------------------------------| |
73 | | -| `--version` | Displays the version of the Fossil Test CLI. | |
74 | | -| `--help` | Shows the help message with usage instructions. | |
75 | | -| `--tip` | Provides a tip or hint about using the Fossil Test CLI. | |
76 | | -| `--info` | Displays information about the test runner. | |
77 | | -| `--author` | Shows information about the author of the test runner. | |
78 | | -| `only=<tag>` or `only=<tags>` | Runs only the tests tagged with the specified tag(s). Tags should be comma-separated for multiple tags. | |
79 | | -| `reverse [enable/disable]` | Enables or disables the reverse order of test execution. | |
80 | | -| `repeat=<number>` | Repeats the test suite for the specified number of times. | |
81 | | -| `shuffle [enable/disable]` | Enables or disables the shuffling of test execution order. | |
82 | | -| `verbose [cutback/normal/verbose]` | Sets the verbosity level of the output. Options are `cutback`, `normal`, and `verbose`. | |
83 | | -| `list` | Lists all available tests. | |
84 | | -| `summary [enable/disable]` | Enables or disables the summary of test results after execution. | |
85 | | -| `color [enable/disable]` | Enables or disables colored output in the terminal. | |
86 | | -| `sanity [enable/disable]` | Enables or disables sanity checks before running the tests. | |
87 | | - |
88 | | -### Examples |
89 | | - |
90 | | -- Display version information: |
91 | | - |
92 | | - ```sh |
93 | | - fossil_cli --version |
94 | | - ``` |
| 78 | +|----------------------------------|-----------------------------------------------------------------------------------------------| |
| 79 | +| `--version` | Displays the current version of Fossil Test. | |
| 80 | +| `--help` | Shows help message with usage instructions. | |
| 81 | +| `--info` | Displays detailed information about the test run. | |
| 82 | +| `reverse [enable/disable]` | Enables or disables reverse order of test execution. | |
| 83 | +| `repeat=<number>` | Repeats the test suite a specified number of times. | |
| 84 | +| `shuffle [enable/disable]` | Enables or disables shuffling of test execution order. | |
95 | 85 |
|
96 | | -- Show help message: |
| 86 | +### Example Usage |
97 | 87 |
|
| 88 | +- Display the version: |
98 | 89 | ```sh |
99 | | - fossil_cli --help |
100 | | - ``` |
101 | | - |
102 | | -- Run only tests tagged with "unit" and "integration": |
103 | | - |
104 | | - ```sh |
105 | | - fossil_cli only=unit,integration |
| 90 | + fossil_cli --version |
106 | 91 | ``` |
107 | 92 |
|
108 | 93 | - Enable reverse order of test execution: |
109 | | - |
110 | 94 | ```sh |
111 | 95 | fossil_cli reverse enable |
112 | 96 | ``` |
113 | 97 |
|
114 | 98 | - Repeat the test suite 5 times: |
115 | | - |
116 | 99 | ```sh |
117 | 100 | fossil_cli repeat=5 |
118 | 101 | ``` |
119 | 102 |
|
120 | | -- Enable verbose output: |
121 | | - |
122 | | - ```sh |
123 | | - fossil_cli verbose verbose |
124 | | - ``` |
125 | | - |
126 | | -- List all available tests: |
127 | | - |
128 | | - ```sh |
129 | | - fossil_cli list |
130 | | - ``` |
131 | | - |
132 | | -- Enable test result summary: |
133 | | - |
134 | | - ```sh |
135 | | - fossil_cli summary enable |
136 | | - ``` |
137 | | - |
138 | | -- Enable colored output: |
139 | | - |
140 | | - ```sh |
141 | | - fossil_cli color enable |
142 | | - ``` |
143 | | - |
144 | | -Feel free to explore and use the various commands and options to tailor the test runner to your needs. For further assistance, refer to the `--help` command. |
| 103 | +--- |
145 | 104 |
|
146 | | -## Configure Options |
| 105 | +## Configure Build Options |
147 | 106 |
|
148 | | -You have options when configuring the build, each serving a different purpose: |
149 | | - |
150 | | -- **Running Tests**: To enable running tests, use `-Dwith_test=enabled` when configuring the build. |
151 | | - |
152 | | -Example: |
| 107 | +To configure the build system with testing enabled, use the following command: |
153 | 108 |
|
154 | 109 | ```sh |
155 | 110 | meson setup builddir -Dwith_test=enabled |
156 | 111 | ``` |
157 | 112 |
|
| 113 | +--- |
| 114 | + |
158 | 115 | ## ***Contributing and Support*** |
159 | 116 |
|
160 | | -If you're interested in contributing to this project, encounter any issues, have questions, or would like to provide feedback, don't hesitate to open an issue or visit the [Fossil Logic Docs](https://fossillogic.com/docs) for more information. |
| 117 | +If you would like to contribute, have questions, or need help, feel free to open an issue on the [Fossil Test GitHub repository](https://github.com/fossillogic/fossil-test) or consult the [Fossil Logic Docs](https://fossillogic.com/docs). |
| 118 | + |
| 119 | +--- |
161 | 120 |
|
162 | | -## ***Conclusion:*** |
| 121 | +## ***Conclusion*** |
163 | 122 |
|
164 | | -Fossil Test is a comprehensive solution for C and C++ developers aiming to ensure the quality and reliability of their code. By supporting both BDD and TDD, along with powerful mocking, assertion detection, detailed reporting, and a robust CLI, Fossil Test empowers developers to create robust and maintainable test suites. Its flexibility and extensibility make it a valuable tool for projects of any size and complexity, fostering a culture of quality and continuous improvement. |
| 123 | +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. |
0 commit comments