Advanced Features

embUnit Tools

Embedded Unit is distributed with four tools to help by generating test template code. The following four tools are distributed:

Tool

Description

tcuppa

generate test template source file.

bcuppa

generate the main file, including main()

tuma

add a code to the code generated by tcuppa.

buma

add a code to the code generated by bcuppa.

For more information read the README in /tools folder.

Advanced Test Runners

EmbUnit offers three more advanced result outputters as an additional static library, They can be taken into use by linking the library and replacing the main -function TextUIRunner and giving it the preferred outputter as reference. An example is below.

1
2
3
4
 TextUIRunner_setOutputter(TextOutputter_outputter());
 TextUIRunner_start();
 TextUIRunner_runTest(shutterTest_tests());
 TextUIRunner_end();

The outputter can be selected from one of the following:

1
2
3
 TextUIRunner_setOutputter(TextOutputter_outputter());
 TextUIRunner_setOutputter(CompilerOutputter_outputter());
 TextUIRunner_setOutputter(XMLOutputter_outputter());

Below is an output of same tests formatted with each outputter:

  • Standard TextOutputter

- shutterTest
1) OK testConstruct
2) OK testRequestUp
3) OK testRequestDown
4) NG testBuffer (shuttertest.c 168) exp 0 was 1

run 4 failures 1
  • CompilerOutputter

shuttertest.c 168: testBuffer: exp 0 was 1

XMLOutputter

<?xml version="1.0" encoding='shift_jis' standalone='yes' ?>
<TestRun>
    <shutterTest>
        <Test id="1">
            <Name>testConstruct</Name>
        </Test>
        <Test id="2">
            <Name>testRequestUp</Name>
        </Test>
        <Test id="3">
            <Name>testRequestDown</Name>
        </Test>
        <FailedTest id="4">
            <Name>testBuffer</Name>
            <Location>
                <File>shuttertest.c</File>
                <Line>168</Line>
            </Location>
            <Message>exp 0 was 1</Message>
        </FailedTest>
    </shutterTest>
    <Statistics>
    <Tests>4</Tests>
    <Failures>1</Failures>
    </Statistics>
</TestRun>