All Projects → Azure → umock-c

Azure / umock-c

Licence: MIT license
A pure C mocking library

Programming Languages

c
50402 projects - #5 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to umock-c

Mockito
Most popular Mocking framework for unit tests written in Java
Stars: ✭ 12,453 (+42841.38%)
Mutual labels:  mock, mocking, mock-library, mocks, mocking-framework
mockingbird
🐦 Decorator Powered TypeScript Library for Creating Mocks
Stars: ✭ 70 (+141.38%)
Mutual labels:  mock, mocking, mock-library, mocks
Msw
Seamless REST/GraphQL API mocking library for browser and Node.js.
Stars: ✭ 7,830 (+26900%)
Mutual labels:  mock, mocking, mocking-framework
Cuckoo
Boilerplate-free mocking framework for Swift!
Stars: ✭ 1,344 (+4534.48%)
Mutual labels:  mock, unit-testing, mocking
Mockaco
🐵 HTTP mock server, useful to stub services and simulate dynamic API responses, leveraging ASP.NET Core features, built-in fake data generation and pure C# scripting
Stars: ✭ 213 (+634.48%)
Mutual labels:  mock, mocking, mocks
Mockolo
Efficient Mock Generator for Swift
Stars: ✭ 327 (+1027.59%)
Mutual labels:  mock, mocking, mocking-framework
Mimic
Seamless client side mocking
Stars: ✭ 380 (+1210.34%)
Mutual labels:  mock, mocking, mocking-framework
Unit Threaded
Advanced unit test framework for D
Stars: ✭ 100 (+244.83%)
Mutual labels:  mock, unit-testing, mocking
mock-inspect
Mocks network requests and allows you to make assertions about how these requests happened. Supports auto-mocking of graphQL requests given a valid schema.
Stars: ✭ 19 (-34.48%)
Mutual labels:  mocking, mocks, mocking-framework
chrome-extension-mocker
The most convenient tool to mock requests for axios, with built-in Chrome extension support.
Stars: ✭ 37 (+27.59%)
Mutual labels:  mock, mocking, mock-library
Mocktopus
Mocking framework for Rust
Stars: ✭ 179 (+517.24%)
Mutual labels:  mock, unit-testing, mocking
aem-stubs
Tool for providing sample data for AEM applications in a simple and flexible way. Stubbing server on AEM, no separate needed.
Stars: ✭ 40 (+37.93%)
Mutual labels:  mock, mocking, mocks
Firebase Mock
Firebase mock library for writing unit tests
Stars: ✭ 319 (+1000%)
Mutual labels:  mock, unit-testing, mocking
Kakapo.js
🐦 Next generation mocking framework in Javascript
Stars: ✭ 535 (+1744.83%)
Mutual labels:  mock, mocking, mocking-framework
automock
A library for testing classes with auto mocking capabilities using jest-mock-extended
Stars: ✭ 26 (-10.34%)
Mutual labels:  mock, unit-testing, mocking
Mockery
A mock code autogenerator for Golang
Stars: ✭ 3,138 (+10720.69%)
Mutual labels:  mock, mocking, mocks
Nsubstitute
A friendly substitute for .NET mocking libraries.
Stars: ✭ 1,646 (+5575.86%)
Mutual labels:  mock, mocking, mocks
Fake Xrm Easy
The testing framework for Dynamics CRM and Dynamics 365 which runs on an In-Memory context and deals with mocks or fakes for you
Stars: ✭ 216 (+644.83%)
Mutual labels:  mock, mocking, mocking-framework
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 (+679.31%)
Mutual labels:  mock, unit-testing, mocking
go-github-mock
A library to aid unittesting code that uses Golang's Github SDK
Stars: ✭ 63 (+117.24%)
Mutual labels:  mock, mocking

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

umock_c

umock_c is a C mocking library.

Setup

Build

  • Clone umock_c by:
git clone --recursive https://github.com/Azure/umock-c.git
  • Create a cmake folder under the root of umock-c

  • Switch to the cmake folder and run

cmake ..

If you would like to use installed (by CMake) versions of packages already on your machine:

cmake -Duse_installed=ON ../
  • Build the code for your platform (msbuild for Windows, make for Linux, etc.) by executing in the cmake folder:
cmake --build .

To install umock_c:

cmake -Duse_installed=ON ../

On Linux:

sudo make install

On Windows:

msbuild /m INSTALL.vcxproj

This requires that ctest and testrunnerswitcher are both installed (through CMake) on your machine.

Building tests

In order to build the tests use the run_unittests cmake option:

cmake .. -Drun_unittests:bool=ON

Example

Ever wanted to write something like this in C as a test?

TEST_FUNCTION(my_first_test)
{
    // arrange
    STRICT_EXPECTED_CALL(test_dependency_1_arg(42))
        .SetReturn(44)
        .IgnoreAllArguments();

    // act
    int result = function_under_test();

    // assert
    ASSERT_ARE_EQUAL(int, 44, result);
    ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}

umock_c has way more features than this simple example!

Dependencies

  • umock_c uses ctest as test runner (https://github.com/Azure/azure-ctest.git). ctest is a C test runner that can be run on many platforms as it does not make use of compiler/platform specific code and thus it is easily portable.
  • umock_c uses cmake (https://cmake.org/) to generate build files.
  • umock_c uses testrunnerswitcher to allow switching between ctest and CppUnitTest for Windows.

Documentation

Complete documentation is available here.

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].