All Projects → google → Cmockery

google / Cmockery

Licence: apache-2.0
A lightweight library to simplify and generalize the process of writing unit tests for C applications.

Programming Languages

c
50402 projects - #5 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to Cmockery

EntityFrameworkCore.AutoFixture
A library aimed to minimize the boilerplate required to unit-test Entity Framework Core code using AutoFixture and in-memory providers.
Stars: ✭ 31 (-95.55%)
Mutual labels:  unit-testing, mocking, tests
umock-c
A pure C mocking library
Stars: ✭ 29 (-95.84%)
Mutual labels:  unit-testing, mocking
Qtools
QTools collection of open source tools for embedded systems development on Windows, Linux and MacOS
Stars: ✭ 64 (-90.82%)
Mutual labels:  embedded-systems, unit-testing
MockitoIn28Minutes
Learn Mockito from In28Minutes
Stars: ✭ 95 (-86.37%)
Mutual labels:  unit-testing, mocking
Acutest
Simple header-only C/C++ unit testing facility.
Stars: ✭ 170 (-75.61%)
Mutual labels:  unit-testing, tests
Mocktopus
Mocking framework for Rust
Stars: ✭ 179 (-74.32%)
Mutual labels:  unit-testing, mocking
unittest expander
A library that provides flexible and easy-to-use tools to parameterize Python unit tests, especially those based on unittest.TestCase.
Stars: ✭ 12 (-98.28%)
Mutual labels:  unit-testing, tests
Unmock Plugin
Gradle plugin to be used in combination with the new unit testing feature of the Gradle Plugin / Android Studio to use real classes for e.g. SparseArray.
Stars: ✭ 304 (-56.38%)
Mutual labels:  unit-testing, mocking
Mockingbird
A convenient mocking framework for Swift
Stars: ✭ 302 (-56.67%)
Mutual labels:  unit-testing, mocking
automock
A library for testing classes with auto mocking capabilities using jest-mock-extended
Stars: ✭ 26 (-96.27%)
Mutual labels:  unit-testing, mocking
Dockertest
Write better integration tests! Dockertest helps you boot up ephermal docker images for your Go tests with minimal work.
Stars: ✭ 2,254 (+223.39%)
Mutual labels:  unit-testing, tests
Dredd
Language-agnostic HTTP API Testing Tool
Stars: ✭ 3,770 (+440.89%)
Mutual labels:  unit-testing, tests
Spring Data Mock
Mock facility for Spring Data repositories
Stars: ✭ 110 (-84.22%)
Mutual labels:  unit-testing, mocking
Sinon Jest Cheatsheet
Some examples on how to achieve the same goal with either of both libraries: sinon and jest. Also some of those goals achievable only by one of these tools.
Stars: ✭ 226 (-67.58%)
Mutual labels:  unit-testing, mocking
Automation Arsenal
Curated list of popular Java and Kotlin frameworks, libraries and tools related to software testing, quality assurance and adjacent processes automation.
Stars: ✭ 105 (-84.94%)
Mutual labels:  unit-testing, mocking
Unit Threaded
Advanced unit test framework for D
Stars: ✭ 100 (-85.65%)
Mutual labels:  unit-testing, mocking
Vcr
Record HTTP calls and replay them
Stars: ✭ 54 (-92.25%)
Mutual labels:  unit-testing, mocking
Cuckoo
Boilerplate-free mocking framework for Swift!
Stars: ✭ 1,344 (+92.83%)
Mutual labels:  unit-testing, mocking
dummyjdbc
dummyjdbc answers database requests with dummy data to be independent of an existing database.
Stars: ✭ 20 (-97.13%)
Mutual labels:  unit-testing, mocking
Firebase Mock
Firebase mock library for writing unit tests
Stars: ✭ 319 (-54.23%)
Mutual labels:  unit-testing, mocking

Cmockery Unit Testing Framework

Build Status

Contents

Cmockery is a lightweight library that is used to author C unit tests.

Overview

Cmockery tests are compiled into stand-alone executables and linked with the Cmockery library, the standard C library, and the module being tested. Any symbols external to the module being tested should be mocked - replaced with functions that return values determined by the test - within the test application. Even though significant differences may exist between the target execution environment of a code module and the environment used to test the code, the unit testing is still valid since its goal is to test the logic of a code modules at a functional level and not necessarily all of its interactions with the target execution environment.

It may not be possible to compile a module into a test application without some modification; therefore, the preprocessor symbol UNIT_TESTING should be defined when Cmockery unit test applications are compiled so code within the module can be conditionally compiled for tests.

More detailed information about the mechanics of writing tests with Cmockery can be found in docs/user_guide.md.

Building

To compile the Cmockery library and example applications on Linux, run:

$ ./configure
$ make

To compile on Windows, run:

> vsvars.bat
> cd windows
> nmake

This code has been tested on Linux (Ubuntu) and Windows using VC++7 and VC++8.

Motivation

There are a variety of C unit testing frameworks available; however, many of them are fairly complex and require the latest compiler technology. Some development requires the use of old compilers which makes it difficult to use some unit testing frameworks. In addition, many unit testing frameworks assume the code being tested is an application or module that is targeted to the same platform that will ultimately execute the test. Because of this assumption, many frameworks require the inclusion of standard C library headers in the code module being tested, which may collide with the custom or incomplete implementation of the C library utilized by the code under test.

Cmockery only requires a test application is linked with the standard C library which minimizes conflicts with standard C library headers. Also, Cmockery tries avoid the use of some of the newer features of C compilers.

This results in Cmockery being a relatively small library that can be used to test a variety of exotic code. If a developer wishes to simply test an application with the latest compiler, then other unit testing frameworks may be preferable.

Community

If you have questions about Cmockery, use the following resources:

  • Stack Overflow: use the cmockery tag

  • Mailing list: cmockery (at) googlegroups.com (archives)

    To join with a Google account, use the web UI; to subscribe/unsubscribe with an arbitrary email address, send an email to:

    • cmockery+subscribe (at) googlegroups.com
    • cmockery+unsubscribe (at) googlegroups.com

License

Cmockery is licensed under the Apache 2.0 license; please see LICENSE.txt for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].