Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sinojelly/mockcpp
Two C/C++ testing tools, mockcpp and testngpp.
https://github.com/sinojelly/mockcpp
catch2 gtest-support mockito test-driven-development testing-tools
Last synced: 28 days ago
JSON representation
Two C/C++ testing tools, mockcpp and testngpp.
- Host: GitHub
- URL: https://github.com/sinojelly/mockcpp
- Owner: sinojelly
- License: apache-2.0
- Created: 2015-03-28T22:17:23.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-08-25T08:23:26.000Z (over 1 year ago)
- Last Synced: 2024-05-22T16:32:48.437Z (7 months ago)
- Topics: catch2, gtest-support, mockito, test-driven-development, testing-tools
- Language: C++
- Homepage:
- Size: 4.86 MB
- Stars: 62
- Watchers: 4
- Forks: 34
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
- awesome-cpp-testing - mockcpp - a jmock-like generic C/C++ Mock Framework, which doesn't use complex template technique which will result in very heavy compiling overhead. (Mock and Stub)
README
mockcpp --- A C/C++ Mock Framework
-------------------------------------
https://github.com/sinojelly/mockcpp
https://gitee.com/sinojelly/mockcppmockcpp is a jmock-like generic C/C++ Mock Framework, which doesn't use complex template technique which will result in very heavy compiling overhead.
## C/C++ test framework
This project provided two tools for C/C++ testing.
| Name | Description | Path |
| ---- | ---- | ---- |
| mockcpp | C/C++ mock framework | mockcpp|
| testngpp | C/C++ test framework | mockcpp/tests/3rdparty/testngpp |The sample project to use these tools is at :
https://gitee.com/sinojelly/testngpp-mockcpp-sampleYou can use mockcpp with other C/C++ test framework, such as gtest, Catch2, CppUTest etc. The sample projects are at:
https://gitee.com/sinojelly/gtest-with-mockcpp
https://gitee.com/sinojelly/catch2-with-mockcppYou can use mockcpp testngpp prebuilt libraries and header files, or use their source code.
If you use the prebuilt libraries, be sure they are built on the same os and compiler as the project that is being tested.
## mockcpp features
| OS | Compiler | Virtual method mock | Global function mock | Overloaded function mock |
| ---- | ---- | ---- | ---- | ---- |
|Linux | GCC | Yes | Yes | Yes |
|Win10 | MinGW | Yes | Yes | Yes |
|Win10 | VS2019 | Yes | No | Yes |## testngpp features
|OS|Compiler|Base function| Memory leak check |Run in Sandbox| Parameterized test |
|----|---- |---- |---- |---- |---- |
|Linux|GCC |Yes |Yes |Yes | Yes |
|Win10|MinGW|Yes |No |No | Yes |
|Win10|VS2019|Yes |Yes |Yes | Yes |## Sample code
### Testngpp parameterized test sample
``` c++
FIXTURE(DataDrivenTest)
{
DATA_PROVIDER( mydata, 3
, DATA_GROUP(1, 2, 3)
, DATA_GROUP(77, 20, 97)
, DATA_GROUP(101, 503, 604));// @test(data="mydata")
PTEST( (int a, int b, int c), this is a parameterized test)
{
ASSERT_EQ(c, add(a, b));
}
};
```
## Documents for user
[New Build System Description](docs/BuildSystemDescription.md)(recommended for user and developers)
[Mockcpp manual english](docs/EnglishManual.md)
[Mockcpp manual chinese](docs/ChineseVersionManual.md)
[Mockcpp simple instruction](docs/SimpleUserInstruction_zh.md) (Chinese, recommended)
[Testngpp simple instruction](tests/3rdparty/testngpp/docs/SimpleUserInstruction_zh.md) (Chinese, recommended)
[Testngpp user manual](tests/3rdparty/testngpp/docs/ChineseUserManual.md) (Chinese)## Documents for developer
[Advanced Guide of Mockcpp](docs/AdvancedGuideOfMockcpp.md)
[Mockcpp version history](docs/ProjectHome.md)
[Software Architecture](docs/SoftwareArchitecture.md) (Chinese)
[Mockcpp configure parameter](docs/Installation.md)
[Mockcpp Build Guide](docs/BuildGuide) (a bit old)
[Mockcpp Install Guide](docs/INSTALL) (old)## Other documents for reference
[Testngpp MSVC Installation](tests/3rdparty/testngpp/docs/InstallationMSVC.md) (old)
[Testngpp Introduction](tests/3rdparty/testngpp/docs/ProjectHome.md)Email to the current maintainers may be sent to
, .