# Customizing the junit xml or Jason output of ctest

**URL:** https://discourse.cmake.org/t/customizing-the-junit-xml-or-jason-output-of-ctest/9638
**Category:** Usage
**Tags:** tool:ctest
**Created:** [December 15, 2023, 6:51am UTC](https://discourse.cmake.org/t/customizing-the-junit-xml-or-jason-output-of-ctest/9638 "2023-12-15T06:51:28Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![pkiran](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/dc4da7/32.png) [@pkiran](https://discourse.cmake.org/u/pkiran)
#### Post date: [December 15, 2023, 6:51am UTC](https://discourse.cmake.org/t/customizing-the-junit-xml-or-jason-output-of-ctest/9638/1 "2023-12-15T06:51:28Z")

</div>

Hello,

Is there a way to add custom fields to the junit or Jason output of a ctest run. For example, fields like the size of executable , ticket id etc . Wondering if such information can be made part of the report.

Thanks

---

<div class="post-metadata">

### Author: ![neundorf](https://discourse.cmake.org/user_avatar/discourse.cmake.org/neundorf/32/2075_2.png) [@neundorf](https://discourse.cmake.org/u/neundorf)
#### Post date: [December 16, 2023, 10:49am UTC](https://discourse.cmake.org/t/customizing-the-junit-xml-or-jason-output-of-ctest/9638/2 "2023-12-16T10:49:27Z")

</div>

Since CMake 3.28 the test labels are exported. Maybe that helps ?

> <https://github.com/Kitware/CMake/commit/b11e8afbfafde5ab70b796b664d82b2684dd272e>
>
> With this patch, the junit files written by ctest also contain the
> test labels a…s testcase properties, see
> https://github.com/testmoapp/junitxml#properties
> 
> The name for the property is "cmake\_labels", where "cmake\_"
> is used namespace-like. This could be done the same way
> if we export more properties to junit.
> Also this makes it clear to consumers that this is coming
> from cmake, and the list is a cmake-formatted string.

---

<div class="post-metadata">

### Author: ![pkiran](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/dc4da7/32.png) [@pkiran](https://discourse.cmake.org/u/pkiran)
#### Post date: [December 16, 2023, 3:10pm UTC](https://discourse.cmake.org/t/customizing-the-junit-xml-or-jason-output-of-ctest/9638/3 "2023-12-16T15:10:55Z")

</div>

This certainly helps:) but I would still propose that measurements, meant for CDash, to be a part of junit xml. Think it would bring value to reporting.

---

<div class="post-metadata">

### Author: ![neundorf](https://discourse.cmake.org/user_avatar/discourse.cmake.org/neundorf/32/2075_2.png) [@neundorf](https://discourse.cmake.org/u/neundorf)
#### Post date: [December 17, 2023, 9:10pm UTC](https://discourse.cmake.org/t/customizing-the-junit-xml-or-jason-output-of-ctest/9638/4 "2023-12-17T21:10:18Z")

</div>

Aren’t those simply parsed by cdash from the stdout of the tests ?  
(which would mean they are not known to ctest)

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [December 19, 2023, 3:37am UTC](https://discourse.cmake.org/t/customizing-the-junit-xml-or-jason-output-of-ctest/9638/5 "2023-12-19T03:37:30Z")

</div>

CTest reads them to know what images to upload for failures, so there is a non-zero awareness of them.
