Test case organisation
Use the GUI to create and organise your unit test specification the way you want it.
- Each test case has its own set-up and tear-down code, and as many individual test steps as you want.
- Put test cases in the same test suite if you want to run them sequentially, one after the other.
- Specify what header files to include and import stub-code directly if necessary.
- Each complete test suite is stored in a separate XML file.
Embunit displays the test suite hierarchy. The content of each test case is shown as a list of high-level operations.

Example test case
Test Driven Development (TDD)
You can define your tests before writing your code. If you haven't finished defining your interfaces - no problem; just go back and add the details later.
No binary file formats
All files used or generated by Embunit are text files.
Test suites and source code can be checked into your version control system and any changes can easily be reviewed using a file comparison utility. Test harnesses can be pulled from the version control system and run automatically as part of the daily build.
Embunit stores the test suite in XML.
Unit test source code generation
You don't need to write a single line of test code, Embunit generates the test harness for you.
You can select whether Embunit generates C or C++ source code.
The automatic code generation means that you have more time to focus on what needs to be tested. You can write tests first, even if you haven't finished defining the interface.

Automatically generated C++ source code
C++ exception handling
Embunit allows you to specify when you expect an exception to be thrown, and optionally to specify the exception type.
You can also test that constructors throw under given conditions.
Embunit automatically inserts catch-all exception handling code so that unexpected exceptions are caught and reported. An unexpected exception aborts the individual test case but not the test suite, allowing subsequent test cases to execute normally.
The use of exception handling is optional, and the catch-all exception handling code can be disabled if desired.
Embedded C++ compilers
Most embedded C++ compilers do not implement all the features of the C++ language, or allow you to switch certain features off. Embunit's C++ code generation does not use the following features:
- Multiple inheritance
- Virtual base classes
- Run-time type information (RTTI)
- New style casts (static_cast, dynamic_cast, reinterpret_cast, and const_cast)
- The mutable type qualifier
- Namespaces
- Templates
Exception handling code can also be disabled, giving full compatibility with the Embedded C++ language (EC++).
Customising Embunit to suit your system
Test results
The way your system indicates whether tests have passed or failed is heavily dependent on the tools you are using and the available I/O. Embunit uses a set of functions that can be customised to suit your target.
The example implementations supplied with Embunit use printf() and std::out to report test results.
Stub code
To make it easier to write clear, maintainable stub code Embunit allows you to specify the test "Context" anywhere in a test case. Stub code has access to the "Context" and can take appropriate action.
Stub code also has access to the test case and test step number
Comparing floating point numbers
Embunit uses a function to test whether two floating point numbers are equal. You can supply your own implementation of this function if necessary.
Custom memory allocation in C
You can define your own memory allocator to be used by the automatically generated source code.
Free trial
Download Embunit today and evaluate it for 30 days using the built in evaluation key. The first time you run Embunit just click the button that says "I want to evaluate the software" in the license management dialog box.
Need longer to evaluate?
No problem, contact us and we will send you a new evaluation key.
Attention all students!
See the FAQ page to find out how to get Embunit for free.