search the lab

Embedded Testing with Unity & CMock (by Mark)

Embedded Testing with Unity & CMock

James Grenning's book (features Unity)

Test Driven Development for Embedded C


Entries in features (3)


Unity Release Notes

Unity 2.0

  • Added optional 64-bit support
  • Added optional parameterized test support
  • Added optional verbose floating point support
  • Added pointer asserts and size options
  • Added array asserts for all numerical types
  • Added fallback memory asserts
  • Added more sample targets (like gcc64 and Hi-Tech PICC)
  • RUN_TEST now has default implementation, so users who don't want to use the scripts can more easily use Unity
  • Significant updates to API and output for consistency
  • Added optional "extras" folder for non-standard uses
    • (like 'fixture' which makes Unity act a bit like CppUTest, originally submitted by James Grenning)
  • Scripts now compatible with Ruby 1.8.6 through 1.9.2

Unity 1.9

  • Added optional floating point support
  • Added configuration options for size of int, etc.
  • Standardized _MESSAGE variants
  • Added YAML files for sample targets to more easily run self-tests on multiple platforms
  • Added example project
  • Started using setjmp / longjmp instead of wrap and return

CMock Release Notes

CMock 2.0

  • Even Better Parser than 1.9 (someday maybe it'll be a full-blown C parser)
    • strange arrays containing arithmetic operators, etc.
    • more difficult anonymous function pointers
    • loads of little detailed fixes here and there.
  • Smart internal memory management
    • CMock 2 has a much smarter built-in memory manager for storing all those expected and returnable values. You can even teach it to understand your processor's alignment and packing needs.
    • It's fast... WAY faster than CMock 1.
    • It's efficient... WAY more compact than CMock 1.
  • Pointers and Arrays
  • The Actual Line Number
    • How embarrassing. When CMock was an internal project it was acceptable to report failures as the line in the Mock file... but the test writer cares about the line in the TEST that failed. We've fixed that.
  • Better variable naming
    • CMock 2 chooses names for internal storage that you're unlikely to run into conflicts with... finally!
  • Supports all the latest Unity assertions internally.

CMock 1.9

  • Better Parser
    • CMock 1 was dandy for developing new code, but when you pointed it at some nasty legacy code or complicated libraries, it cried and hid its head in shame. No longer! CMock handles all sorts of craziness. Unnamed arguments, custom types, function pointers... it happily crunches through all of it and gives you your mocked goodies.
  • Easier Configuration
    • We admit it, the original CMock was kinda painful sometimes. We hope you'll find the latest version a more pleasant experience.
  • Pointers and Arrays
    • CMock 1 was a little lazy sometimes. When you passed a pointer as an argument, it just assumed you wanted to compare pointers. Often this wasn't the desired behavior. Now, you're in control. With the array plugin, you can specify if you want the pointer compared, the object being pointed to, or if that pointer is actually an array that should be compared.
    • Arguments can actually be function pointers now. How cool is that?
  • Stubs and Callbacks
    • Sometimes you want to fill data into an object being pointed to
    • Sometimes you want to perform really complicated comparisons in your mocks
    • Sometimes you want to trigger custom events during your mock calls
    • The new callback plugin gives you the power to do all that

CMock Roadmap

This is a rough idea of where we are going with CMock. Feel free to add your thoughts and comments. We'd love to hear them!

CMock 2.5

  • This is a performance milestone. It's all about efficiency. We want the generated C code to be smaller and faster. We want it to handle memory even more awesomely than it does now. Also, CMock itself will get faster so that you get the goods as soon as possible.

CMock 3.0

  • We're exploring the idea of making CMock handle C and C++. We haven't seen a tool out there that does this well at the moment... and we figure why not us?
  • What else are you interested in?