cmocka is...

an elegant unit testing framework for C with support for mock objects. It only requires the standard C library, works on a lot of platforms (including embedded) and with different compilers.


Download here » or Learn More

Features

  • Support for Mock Objects
    Mock objects are simulation objects to mimic the real implementation of an actual object.
    Useful to simulate dependencies of an interface to help test the interface in isolation.
    Some project use the mock functionality to simulate components communicating over a network
  • Only requires a C library
    This makes it possible that it works on a lot of embedded platforms.
  • Fully documented API
    The API is very well documented and cmocka provides several examples for the different features it provides.
  • Test Fixtures
    Test fixtures are setup and teardown functions that can be shared across multiple test cases to provide common functions to prepare the test environment and destroy it afterwards.
  • Exception handling for signals (SIGSEGV, SIGILL, ...)
    cmocka is able to recover the test state if there are execptions like a segfault.
  • No fork()
    cmocka doesn't use fork() for exception handling in test cases.
  • Very well tested
    cmocka has nightly builds to test on several platforms and with different compilers to ensure it works correctly. If you want to get it working on your platform you can add a nightly build and we will make sure not to break your platform or compiler.
  • Testing of memory leaks, buffer overflows and underflows.
  • License: Apache License 2.0

Mission Statement

The goal of this project is to provide a powerful testing framework for C, on different platforms and operating systems, which only requires the standard C library.


CMocka minimizes conflicts with standard C headers especially on a lot of different platforms.

Currently CMocka is tested on Linux, FreeBSD, Solaris, MacOSX, and Windows. See the Testing Dashboard

News

2014-04-11 cmocka 0.4.0 has been released
2013-11-06 cmocka 0.3.2 has been released
2013-07-10 cmocka 0.3.1 has been released
2013-06-05 cmocka 0.3.0 has been released

Flattr this

Documentation

The API documentation can be found here: http://api.cmocka.org/

Development

cmocka is developed using the git version control system. You can find the web interface of the git respository at:

http://git.cryptomilk.org/projects/cmocka.git/

Discussion

  • Bugs can be reported to the CMocka Bugtracker
  • To subscribe send a mail to: cmocka+subscribe@cryptomilk.org
  • You can find the mailinglist archive here.
  • IRC: #cmocka @ irc.freenode.net