Unit testing and build system for C projects
Ceedling 1.1.8 is the latest and greatest.
See [Release Notes][release-notes], Changelog, [Breaking Changes][breaking-changes], and [Known Issues][known-issues].
See Getting Started for installation and new project set up.
New goodies in 1.1.x:
static and inline functions without modifying source code.Ceedling can build your release artifact but is especially adept at building unit test suites for your C projects — even in tricky embedded systems.
⭐️ Eager to just get going? Jump to Documentation & Learning and Getting Started.
For a test suite project using the default toolchain gcc, Ceedling’s
configuration file could be as simple as this:
:project:
:build_root: project/build/
:paths:
:test:
- tests/**
:source:
- source/**
:include:
- inc/**To execute all your unit tests, you would run ceedling test:all. That‘s it!
Ceedling works the way developers want to work. It is flexible and entirely command-line driven. It drives code generation and command line tools for you. All generated and framework code is easy to see and understand.
Ceedling’s features support all types of C development from low-level embedded to enterprise systems. No tool is perfect, but Ceedling can do a whole lot to help you and your team produce quality software.
Ceedling and its complementary ThrowTheSwitch pieces and parts are and always will be freely available and open source.
Ceedling Suite is a growing collection of paid products and services built around Ceedling to help you do even more. Ceedling Assist for support contracts and training is now available.
Please consider supporting Ceedling as a Github Sponsor
Ceedling is also a suite of tools. It is the glue for bringing together two other awesome open-source projects you can’t live without if you‘re creating awesomeness in the C language.
If you are a Visual Studio Code user, you may also be interested in the Ceedling extension.
† Through a plugin, Ceedling also supports FFF for fake functions as an alternative to CMock’s mocks and stubs.
For simple project structures, Ceedling can build and test an entire project from just a few lines in its project configuration file.
Because it handles all the nitty-gritty of rebuilds and because of Unity and CMock, Ceedling makes Test-Driven Development in C a breeze. It even provides handy backtrace debugging options for finding the source of crashing code exercised by your unit tests.
Ceedling is extensible with a simple plugin mechanism. It comes with a number of [built-in plugins][ceedling-docs-plugins] for code coverage, test suite report generation, Continuous Integration features, IDE integration, release library builds & dependency management, and more.
Ceedling release numbering follows SemVer convention. See the Getting Started section for installation details for both official releases and prereleases.
Releases have a version number #.#.# (..). Production systems and automated tooling should rely on official releases and not prereleases.
Official releases are available as:
gem install ceedling --no-document at the command line).The latest . version is supported with limited support for earlier minor releases.
Bug fix patches .. are official releases. Generally speaking, if you have adopted a . release, you should update to bug fix releases when available.
All official releases are retained historically.
In rare cases of fatal flaws, severe security vulnerabilities, etc. an official release may be pulled.
Prerelease versions include pre in their version numbering (#.#.#-pre.#). Prereleases are only available as downloadable .gem files attached to release listings. These require local installation steps including some basic dependencies management.
Prereleases are ephemeral and will be pulled as development continues or bugs are found. Prereleases should not be relied upon in production systems or automated tooling. At an official release, all prior prereleases will be pulled.
Prereleases are not officially supported, but feedback through submitting issues is very much welcome. As much help as is practical will be offered to support those exercising prereleases.
The ThrowTheSwitch community follows a code of conduct.
Please familiarize yourself with our guidelines for contributing to this project, be it code, reviews, documentation, or reports.
Yes, work has begun on Ceedling Certified, a validated version of Ceedling to meet the needs of industry software certification.
While Ceedling can build your release artifact, its claim to fame is building and running test suites.
There’s a good chance you’re looking at Ceedling because of its test suite abilities. And, you’d probably like to see what that looks like, huh? Well, let’s cook you up some realistic examples of tested code and running Ceedling with that code.
(A sample Ceedling project configuration file and links to documentation for it are a bit further down in Getting Started.)
…#include "Oven.h"
#include "Time.h"
#include "Baking.h"
bool_t Baking_PreheatOven(float setTempF, duration_t timeout) {
float temperature = 0.0;
Timer* timer = Time_StartTimer( timeout );
Oven_SetTemperatureF( setTempF );
while (temperature = setTempF);
}
Some of what Ceedling does is by naming conventions. See Ceedling’s documentation for much more on this.
…Let’s flavor our test code with a dash of mocks as well…
…See Ceedling’s documentation for examples and everything you need to know about Ceedling’s configuration file options (not shown here).
The super duper short version is that your project configuration file tells Ceedling where to find test and source files, what testing options you’re using, sets compilation symbols and build tool flags, enables your plugins, and configures your build tool command lines (Ceedling defaults to using the GNU compiler collection — which must be installed, if used).
> ceedling test:all#ChefsKissThe test results below are one of the last bits of logging Ceedling produces for a test suite build. Not shown here are all the steps for extracting build details, C code generation, and compilation and linking.
-------------------
FAILED TEST SUMMARY
-------------------
[test/TestBaking.c]
Test: test_Baking_PreheatOven_shouldFailIfSettingOvenTemperatureFails
At line (7): "Function Time_SleepMs() called more times than expected."
-----------------------
❌ OVERALL TEST SUMMARY
-----------------------
TESTED: 6
PASSED: 5
FAILED: 1
IGNORED: 0The Unity project supports parameterized test cases like this:
TEST_RANGE([5, 100, 5])
void test_should_handle_divisible_by_5_for_parameterized_test_range(int num) {
TEST_ASSERT_EQUAL(0, (num % 5));
}Ceedling can do all the magic to build and run this test code simply by enabling parameterized test cases in its project configuration. Keep reading for more on how to configure a Ceedling build.
:unity:
:use_param_tests: TRUEA variety of options for community-based support exist.
Training and support contracts are available through Ceedling Assist
The Agile Embedded Podcast includes an [episode on Ceedling][ceedling-episode]!
No open issues yet, or sync has not completed.