# Test start time stamp in junit xml output

**URL:** https://discourse.cmake.org/t/test-start-time-stamp-in-junit-xml-output/9800
**Category:** Usage
**Tags:** tool:ctest
**Created:** [January 9, 2024, 11:07pm UTC](https://discourse.cmake.org/t/test-start-time-stamp-in-junit-xml-output/9800 "2024-01-09T23:07:51Z")
**Posts on this page:** 4
**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: [January 9, 2024, 11:07pm UTC](https://discourse.cmake.org/t/test-start-time-stamp-in-junit-xml-output/9800/1 "2024-01-09T23:07:51Z")

</div>

Hi all,

Would it be possible to add the timestamp for a test node when the test starts, in the generated junit xml. I would suggest Unix epoch in milliseconds. Think it would be useful in generating a timeline of execution.

Would be interested in your feedback

Thanks  
Best regards  
Phani

---

<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: [January 11, 2024, 1:50pm UTC](https://discourse.cmake.org/t/test-start-time-stamp-in-junit-xml-output/9800/2 "2024-01-11T13:50:09Z")

</div>

Is there precedent in other JUnit output from other tools? Or examples of what JUnit-consuming tools are looking for? I’m very hesitant to start extending JUnit in CMake-specific ways because things like that always turn into a maintenance nightmare. If you find examples, feel free to [open a feature request](https://gitlab.kitware.com/cmake/cmake/-/issues).

Though I think I see [an issue](https://gitlab.kitware.com/cmake/cmake/-/issues/25509) already.

---

<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: [January 13, 2024, 10:06am UTC](https://discourse.cmake.org/t/test-start-time-stamp-in-junit-xml-output/9800/3 "2024-01-13T10:06:34Z")

</div>

Hi Ben,

Junit5 generates time stamps per test in its junit report. Example can be seen here: [JUnit 5 XML Report Example](https://howtodoinjava.com/junit5/xml-reports/)

Seems like junit5 now follows Open Test Reporting formats, shown here:

- [GitHub - ota4j-team/open-test-reporting: Language-agnostic test reporting format and tooling](https://github.com/ota4j-team/open-test-reporting#hierarchical-format)
- [JUnit 5 User Guide](https://junit.org/junit5/docs/current/user-guide/#advanced-topics)  
may be a good idea to follow this? not sure 🙂 Junit itself has started following this.

Also some other schemas i could find:

- [GitHub - windyroad/JUnit-Schema: XSD for Apache Ant's JUnit output](https://github.com/windyroad/JUnit-Schema/tree/master)

I realise not many tools have this in their junit report, so I wont push for this any more 🙂  
Only reason for this request is that if this start time stamp is present per testcase, then i can have one place to get a execution timeline of different tests, which is very valuable to optimize the test execution.

I will leave the decision upto you, but thanks a lot for your time so far 🙂

Thanks  
Phani

---

<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: [January 13, 2024, 10:34am UTC](https://discourse.cmake.org/t/test-start-time-stamp-in-junit-xml-output/9800/4 "2024-01-13T10:34:48Z")

</div>

Thanks for the research; do you mind putting this into the issue for whoever may work on it?
