wiki:Projects/GSoC/TestingReview/CMock

Version 13 (modified by Xiaochen Pan, on Jul 7, 2012 at 8:34:38 AM) (diff)

/* psx01 test */

TestingReview/CMock

General Description

CMock is a highly automated testing framework based on Unity, a unit testing framework. It have also provided handy tools supporting mocking functionality.

+ Support rich sets of assertions.

+ CMock supports setUp() and tearDown() functions runned before and after each test functions, which is exactly like in test fixtures. In this way, we say that CMock support xUnit.

+ With the heavy usage of Ruby, which enables the high level of automation, comes with highly strict test-writing format and light tests writing effort compared to other testing frameworks supporting mocking functionality.

+ Flexible. It can still be used script-free.

+ It is well suited for both RTEMS based and Host based testing, where RTEMS-based testing is hard to guarantee for a large number of tests frameworks.

+ It supports several compilation options, such as CMOCK_MEM_STATIC and CMOCK_MEM_SIZE, the combination of which limits the total amount of memory the testing program could use during run time. If the tests needs more memory than specified, it quit tests. Also, there are a lot of other compilation options that facilitate testing under embedded environments.

+ The tests results are reported with line number and function names indicated.

+ The scripts-rich feature have largely automated test running process, with test runner automatically generated and mock functions automatically generated.

+ Unlike other test framework evaluated, it is upgradable to Ceedling, which is a another script driven framework based on CMock and Unity, and Ceedling is more automated than CMock.

Test Result

SP01 test

File:Unity sp.png?

In the above test result, because after the last test, it deletes itself, so the test output for that test does not show up. But from the total test display, it can be concluded that that test has also passed since all five tests have passed.


deviceio01 test

File:Unity deviceio01.png?


fsrofs01 test

File:Unity fsrofs01.png?


psx01 test

File:Unity psx01.png?

Then it prints:

Task_1: pthread_once - SUCCESSFUL (init_routine does not execute) * END OF POSIX TEST 1 *

I did not use snapshot to save space.