CheckOps home

Tools directory

U

CheckOps

Unity Test (C)

Unity is an MIT-licensed unit testing framework for C focused on embedded toolchains, consisting of a single C file and two headers, from ThrowTheSwitch.org alongside CMock and Ceedling.

Visit website

Latest public signals

Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.

Visit Website

Introduction

Unity Test is a unit testing framework built for C, with a focus on working with embedded toolchains, according to its README. It is designed to test code targeting microcontrollers big and small, and its core is a single C file and a pair of headers, so it can be added to an existing build without much trouble. Any compiler and most build systems, including Make and CMake, can be used.

Tests are plain C functions that call assertions such as TEST_ASSERT_EQUAL_INT, TEST_ASSERT_TRUE, TEST_ASSERT_EQUAL_STRING, TEST_ASSERT_EQUAL_HEX8, TEST_ASSERT_FLOAT_WITHIN and array and memory comparisons, with optional messages. setUp and tearDown run around each test, and RUN_TEST drives them from a runner function (which can be generated by a script). Unity is part of the ThrowTheSwitch.org toolset with CMock, which generates mocks from C headers, and Ceedling, a build tool that automates test discovery, mocking and running. Configuration options adapt it to targets without floating point, printf or standard output. Version 2.7.0 was released on 16 July 2026.

The source code is at ThrowTheSwitch/Unity on GitHub under the MIT licence, with about 5,500 stars; the most recent commit was on 31 October 2026.

Features

  1. Tiny footprint: One C file and two headers.
  2. Embedded focus: Runs on microcontrollers and hosts.
  3. Rich C assertions: Integers, hex, floats, strings, arrays and memory.
  4. Ecosystem: CMock for mocks and Ceedling for builds.

Pros

  1. Free to use: Open source under the MIT licence, so the core tool costs nothing to use.
  2. Actively maintained: The repository had commits as recent as 31 October 2026.
  3. Community: About 5,500 GitHub stars.

Cons

  1. Manual runners without Ceedling: Test runners must be written or generated.
  2. C only: C++ projects may prefer other frameworks.
#include "unity.h"
#include "ring_buffer.h"

void setUp(void) { rb_init(); }
void tearDown(void) {}

void test_starts_empty(void) {
    TEST_ASSERT_TRUE(rb_is_empty());
}

void test_push_pop(void) {
    rb_push(42);
    TEST_ASSERT_EQUAL_INT(42, rb_pop());
}

int main(void) {
    UNITY_BEGIN();
    RUN_TEST(test_starts_empty);
    RUN_TEST(test_push_pop);
    return UNITY_END();
}

Resources:

Pricing

Unity Test (C) is free and open source under the MIT licence.

  1. Embedded C developers testing on host or target.
  2. Teams adopting TDD for firmware with CMock and Ceedling.

Conclusion

Unity is the go-to lightweight unit testing framework for embedded C, simple to integrate and backed by a complete toolchain.

Alternatives

Other tools on CheckOps that cover similar ground. Open a page, or compare one with Unity Test (C) side by side.