---
# System prepended metadata

title: CMocka
tags: [DevOps, CI/CD, Testing, III]

---

CMocka
===

###### tags: `III` `DevOps` `Testing` `CI/CD`

- [The CMocka APIs](https://api.cmocka.org/group__cmocka.html)
- [Enabling XML Output](https://embeddedartistry.com/blog/2017/10/16/cmocka-enabling-xml-output/)

## JUnit XML Report
* A report can contain 1 or more test suite.
* Each test suite also contains 1 or more test case.
* Each test case will either contain a skipped, failure or error node if the test did not pass. If the test case has passed, then it will not contain any nodes. 
```
<testsuites>        => the aggregated result of all junit testfiles
  <testsuite>       => the output from a single TestSuite
    <properties>    => the defined properties at test execution
      <property>    => name/value pair for a single property
      ...
    </properties>
    <error></error> => optional information, in place of a test case - normally if the tests in the suite could not be found etc.
    <testcase>      => the results from executing a test method
      <system-out>  => data written to System.out during the test run
      <system-err>  => data written to System.err during the test run
      <skipped/>    => test was skipped
      <failure>     => test failed
      <error>       => test encountered an error
    </testcase>
    ...
  </testsuite>
  ...
</testsuites>
```
:::info
An **errored test** is one that had an unanticipated problem. e.g., an unchecked throwable; or a problem with the implementation of the test.

A **failure** is a test which the code has explicitly failed by using the mechanisms for that purpose. e.g., via an assertEquals.
:::