Google Test VS Unity Test API

Compare Google Test vs Unity Test API and see what are their differences.

Google Test

GoogleTest - Google Testing and Mocking Framework (by google)
Nutrient - The #1 PDF SDK Library
Bad PDFs = bad UX. Slow load times, broken annotations, clunky UX frustrates users. Nutrient’s PDF SDKs gives seamless document experiences, fast rendering, annotations, real-time collaboration, 100+ features. Used by 10K+ devs, serving ~half a billion users worldwide. Explore the SDK for free.
nutrient.io
featured
CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
Google Test Unity Test API
71 16
35,430 4,265
0.8% 1.9%
6.4 5.9
1 day ago 23 days ago
C++ C
BSD 3-clause "New" or "Revised" License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

Google Test

Posts with mentions or reviews of Google Test. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-11-24.
  • The Two Factions of C++
    15 projects | news.ycombinator.com | 24 Nov 2024
    > Googletest ... declares a direct dependency on an older LTS release of absl

    Looking at the build configuration code:

    https://github.com/google/googletest/blob/main/CMakeLists.tx...

    it seems like the dependence on Abseil is optional. i.e. you can use googltest on its own. I wouldn't recommend it (I kinda like doctest), but still.

  • Getting started with GoogleTest and CMake
    1 project | dev.to | 11 Aug 2024
    include(FetchContent) # Fetch GoogleTest FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG release-1.11.0 ) FetchContent_MakeAvailable(googletest) # Collect C++ source files recursively file(GLOB_RECURSE CXX_FILES "${CMAKE_CURRENT_LIST_DIR}/*.cpp") add_executable(unit_tests ${CXX_FILES}) # Link GoogleTest libraries target_link_libraries(unit_tests PRIVATE gtest_main ${PROJECT_NAME}_lib # Link to the main project library ) # Include directories (including where GoogleTest is built) target_include_directories(unit_tests PRIVATE ${gtest_SOURCE_DIR}/include) # Add include directories for tests to find headers target_include_directories(unit_tests PRIVATE ${PROJECT_SOURCE_DIR}/src) # Enable testing and discover tests # Discover and run tests include(GoogleTest) gtest_discover_tests(unit_tests)
  • Open Source C++ Stack
    10 projects | dev.to | 16 Jul 2024
    Google Test
  • Creating k-NN with C++ (from Scratch)
    6 projects | dev.to | 11 Jan 2024
    cmake_minimum_required(VERSION 3.5) project(knn_cpp CXX) include(FetchContent) FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG release-1.11.0 ) FetchContent_MakeAvailable(googletest) FetchContent_Declare(matplotplusplus GIT_REPOSITORY https://github.com/alandefreitas/matplotplusplus GIT_TAG origin/master) FetchContent_GetProperties(matplotplusplus) if(NOT matplotplusplus_POPULATED) FetchContent_Populate(matplotplusplus) add_subdirectory(${matplotplusplus_SOURCE_DIR} ${matplotplusplus_BINARY_DIR} EXCLUDE_FROM_ALL) endif() function(knn_cpp_test TEST_NAME TEST_SOURCE) add_executable(${TEST_NAME} ${TEST_SOURCE}) target_link_libraries(${TEST_NAME} PUBLIC matplot) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../lib LIB_SOURCES) target_link_libraries(${TEST_NAME} PRIVATE gtest gtest_main gmock gmock_main) target_include_directories(${TEST_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../) target_sources(${TEST_NAME} PRIVATE ${LIB_SOURCES} ) include(GoogleTest) gtest_discover_tests(${TEST_NAME}) endfunction() knn_cpp_test(LinearAlgebraTest la_test.cc) knn_cpp_test(KnnTest knn_test.cc) knn_cpp_test(UtilsTest utils_test.cc)
  • Starting with C
    2 projects | dev.to | 1 Jan 2024
    Okay, time to start unit tests!!! We will use Unity Test Framework to do unit testing. It is one of widely used testing frameworks alongside with Check, Google Test etc. Just downloading source code, and putting it to the project folder is enough to make it work (that is also why it is portable).
  • Just in case: Debian Bookworm comes with a buggy GCC
    1 project | dev.to | 15 Dec 2023
    Updating GCC (it happened to GoogleTest).
  • Automatically run tests, formatters & linters with CI!
    5 projects | dev.to | 15 Nov 2023
    Roy's project uses Google Test, a C++ testing framework. His testing setup is similar to mine as we both keep source files in one directory and tests in another. The key difference is that I can run the tests using the Visual Studios run button. It was fairly easy to write the new tests as there were existing ones that I could reference to check the syntax!
  • C++ Unit Testing Using Google Test - My Experience
    3 projects | dev.to | 12 Nov 2023
    The Google Test Documentation provides a primer for first-time users. The primer introduces some basic concepts and terminology, some of which I've been able to learn for this lab exercise.
  • Basic C++ Unit Testing with GTest, CMake, and Submodules
    2 projects | dev.to | 26 Sep 2023
    > git submodule add https://github.com/google/googletest.git > git submodule update --init --recursive
  • VS code + cmake + gtest?
    1 project | /r/vscode | 3 Sep 2023
    cmake_minimum_required(VERSION 3.14) project(my_project) # GoogleTest requires at least C++14 set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) include(FetchContent) FetchContent_Declare( googletest URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip ) # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) enable_testing() add_executable( hello_test hello_test.cpp ) target_link_libraries( hello_test GTest::gtest_main ) include(GoogleTest) gtest_discover_tests(hello_test)

Unity Test API

Posts with mentions or reviews of Unity Test API. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-12-07.
  • Ask HN: Best dev environment for C in 2024?
    4 projects | news.ycombinator.com | 7 Dec 2024
    There are plenty of good IDE in 2024 for any languages; C included.

    For the IDE itself, the big choices are between Jetbrains CLion and VSCode. If you are familiar with Jetbrains product for another language, stick to it. Same for VSCode, if you’re use to it, just install the right plugins.

    I personally prefer Jetbrains product because it is working without selecting/installing all the plugins. Some people likes to tweak their environment. So, I don’t use a lot of plugins on the IDE.

    I use VSCode only when I have multiple stack in the same project (typically Flutter project which include the Dart part and the native part). In that case, VSCode is more practical.

    In the embedded world, there is also Kiel for ARM embedded development. (https://www.keil.com/). I was never be able to use it. It is really unnatural to me but a lot of embedded C developers love it.

    Regarding the dev tools, I prefer to use tools that are multi platform and widely used. So, the dev tools include CMake, make and GNU C compiler. It is a pretty common toolkit that covered my needs so far.

    Unit tests are written with Unity Test Framework (https://github.com/ThrowTheSwitch/Unity). It is simple and allow to be executed on the target if required; which is practical for embedded development.

  • Jenkins not detecting test fail
    1 project | /r/jenkinsci | 28 Jun 2023
  • Unit testing tool suggestions
    2 projects | /r/learnprogramming | 7 May 2023
    Here is the github repo link of Unity: https://github.com/ThrowTheSwitch/Unity
  • What is the best Unit testing framework for VS code for C?
    2 projects | /r/cprogramming | 23 Mar 2023
    You shouldn't need a configuration file to write tests with Unity. You are using Unity from Unity on Github right? You can use YAML files to along with some helper scripts Unity and related tools provide, but it doesn't sound like you are there yet.
  • In C++, why am I getting an error about iterators going out of range of a vector in a statement that uses neither iterations nor vectors?
    1 project | /r/learnprogramming | 7 Apr 2022
    First, for context, as part of my internship, I'm writing unit tests for functions from a hardware manufacturer provided C++ library. This particular code is testing if the relevant function returns a unique location ID for each hardware device. The test assert macro I'm using is from the Unity test framework C library.
  • commonly used c-unit testing framework in 2022?
    3 projects | /r/cprogramming | 21 Mar 2022
    I use Unity Fixtues + FFF + CException framework.
  • Where can I find information on how to use specific Unity test framework macros in C/C++?
    1 project | /r/learnprogramming | 24 Feb 2022
    Edit: I also tried Googling "list of Unity test framework macros" and found this, which is kind of helpful, but still doesn't actually explain how the correct syntax for specific macros or precisely what they do. I guess basically, I'm looking for something similar to the entries on cppreference.com, but for the Unity macros instead of the standard library functions for C++.
  • industry standard for Test frameworks?
    3 projects | /r/C_Programming | 6 Feb 2022
    I know Unity is used in the embedded industry, I also use it for my own personal projects. It’s great and does everything I need.
  • Testing Frameworks for C++, ESP32
    4 projects | /r/embedded | 1 Sep 2021
    If you're using the ESP-IDF framework, it already comes with Unity. It's easy to use, and you have the Test Driven Development for Embedded C book as reference.
  • Unit Testing in C
    6 projects | /r/C_Programming | 29 Jun 2021
    I use the Unity Test Framework: https://github.com/ThrowTheSwitch/Unity

What are some alternatives?

When comparing Google Test and Unity Test API you can also consider the following projects:

Catch - A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)

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

doctest - The fastest feature-rich C++11/14/17/20/23 single-header testing framework

CppUnit - C++ port of JUnit

esp-idf - Espressif IoT Development Framework. Official development framework for Espressif SoCs.

Boost.Test - The reference C++ unit testing framework (TDD, xUnit, C++03/11/14/17)

fff - A testing micro framework for creating function test doubles

benchmark - A microbenchmark support library

minUnit - Minimal unit testing framework for C

Nutrient - The #1 PDF SDK Library
Bad PDFs = bad UX. Slow load times, broken annotations, clunky UX frustrates users. Nutrient’s PDF SDKs gives seamless document experiences, fast rendering, annotations, real-time collaboration, 100+ features. Used by 10K+ devs, serving ~half a billion users worldwide. Explore the SDK for free.
nutrient.io
featured
CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured

Did you know that C++ is
the 7th most popular programming language
based on number of references?