C/C++ common unit testing framework

CUnit

  • CUnit is a white-box test case for developing source code in the C language environment. CUnit is provided to users in the form of a static library, and users can directly link this static library when writing a program. It provides a simple unit testing framework, and provides rich assertion statement support for commonly used data types. CUnit official website

CppUnit

  • It is an open source project based on LGPL. The original version was transplanted from JUnit, which is an excellent open source testing framework. The main idea of ​​CppUnit, like JUnit, comes from Extreme Programming (XProgramming). The main function is to manage unit tests and automate tests. CppUnit

GTest

  • It is an open source C/C++ unit testing framework released by Google. It has been used in many open source projects and internal Google projects. Well-known examples include Chrome Web browser, LLVM compiler architecture, Protocol Buffers data exchange format and tools, etc. . GoogleTest

CppUTest

  • It is a full-featured testing framework, specially designed to support the development of embedded software on multiple operating systems. CppUTest's macros are designed to be able to write test cases without knowing C++. This makes it easier for C programmers to use this testing framework. CppUTest only uses the main subset of the C++ language. This choice is well suited for embedded development where the compiler cannot fully support all C++ language features. You will see that the unit tests written in Unity and CppUTest are almost identical. Of course, you can choose any test framework for your product development. CppUTest

CppUnit

Difference and connection

  • Excellent C/C++ unit testing frameworks are not few, and gtest still has obvious advantages in comparison. Compared with CppUnit, gtest needs to use header files and function macros more concentrated, and supports automatic registration of test cases. Compared with CxxUnit, gtest does not require the existence of external tools such as Python. Compared with Boost.Test, gtest is more concise and easy to use, and its practicality is not inferior.
  • CppTest is a unit testing framework for C++. Simpler than CppUnit, but without losing its flexibility. CppTest can assist C/C++ developers to perform code testing, thereby reducing the difficulty of maintenance. Like CppUnit, it provides equipment, macros for assertions, and output formatters.
  • Test Driven Development (TDD) takes testing as the center of the development process. It insists on writing test code based on product code before writing actual code. The goal of the development process is to first make the test pass, and then optimize the design structure. Test-driven development is an important part of Extreme Programming. XUnit, a test framework based on test-driven development, provides a convenient tool for us to use test-driven development in the development process, allowing us to quickly perform unit tests. There are many members of XUnit, such as JUnit, PythonUnit, etc. CppUnit is a member of the XUnit family, which is a testing framework specifically for C++.

Guess you like

Origin blog.csdn.net/oTianLe1234/article/details/115298753