5 best C++ Mock libraries in 2024

share link

by marketing.admin@openweaver.com dot icon Updated: Mar 13, 2023

technology logo
technology logo

Guide Kit Guide Kit  

Mocking frameworks allow you to replace a specific call to a class or method with a behavior you define. A mock object returns dummy data corresponding to some dummy input passed to it. Mock objects can be used as a replacement for real objects in unit testing, they often also record how they were used so that you can make assertions about this after the test has finished. When writing tests, developers often need to mock external libraries (e.g., database, network connections and etc.) to control the response from an external service. In C++, there are some good tools for this purpose.. These are the 5 best C++ Mock libraries CppUTes - unit testing and mocking framework for C/C; FakeIt - C++ mocking made easy; trompeloeil - Header only C14 mocking framework.

cpputestby cpputest

C++ doticonstar image 1217 doticonVersion:latest-passing-builddoticon
License: Permissive (BSD-3-Clause)

CppUTest unit testing and mocking framework for C/C++

Support
    Quality
      Security
        License
          Reuse

            cpputestby cpputest

            C++ doticon star image 1217 doticonVersion:latest-passing-builddoticon License: Permissive (BSD-3-Clause)

            CppUTest unit testing and mocking framework for C/C++
            Support
              Quality
                Security
                  License
                    Reuse

                      FakeItby eranpeer

                      C++ doticonstar image 1081 doticonVersion:2.3.2doticon
                      License: Permissive (MIT)

                      C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.

                      Support
                        Quality
                          Security
                            License
                              Reuse

                                FakeItby eranpeer

                                C++ doticon star image 1081 doticonVersion:2.3.2doticon License: Permissive (MIT)

                                C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.
                                Support
                                  Quality
                                    Security
                                      License
                                        Reuse

                                          trompeloeilby rollbear

                                          C++ doticonstar image 708 doticonVersion:v44doticon
                                          License: Permissive (BSL-1.0)

                                          Header only C++14 mocking framework

                                          Support
                                            Quality
                                              Security
                                                License
                                                  Reuse

                                                    trompeloeilby rollbear

                                                    C++ doticon star image 708 doticonVersion:v44doticon License: Permissive (BSL-1.0)

                                                    Header only C++14 mocking framework
                                                    Support
                                                      Quality
                                                        Security
                                                          License
                                                            Reuse

                                                              CMockby ThrowTheSwitch

                                                              C doticonstar image 568 doticonVersion:v2.5.3doticon
                                                              License: Permissive (MIT)

                                                              CMock - Mock/stub generator for C

                                                              Support
                                                                Quality
                                                                  Security
                                                                    License
                                                                      Reuse

                                                                        CMockby ThrowTheSwitch

                                                                        C doticon star image 568 doticonVersion:v2.5.3doticon License: Permissive (MIT)

                                                                        CMock - Mock/stub generator for C
                                                                        Support
                                                                          Quality
                                                                            Security
                                                                              License
                                                                                Reuse

                                                                                  mocxxby Guardsquare

                                                                                  C++ doticonstar image 113 doticonVersion:Currentdoticon
                                                                                  License: Strong Copyleft (GPL-3.0)

                                                                                  A versatile C++ function mocking framework.

                                                                                  Support
                                                                                    Quality
                                                                                      Security
                                                                                        License
                                                                                          Reuse

                                                                                            mocxxby Guardsquare

                                                                                            C++ doticon star image 113 doticonVersion:Currentdoticon License: Strong Copyleft (GPL-3.0)

                                                                                            A versatile C++ function mocking framework.
                                                                                            Support
                                                                                              Quality
                                                                                                Security
                                                                                                  License
                                                                                                    Reuse

                                                                                                      See similar Kits and Libraries