Skip to content

Introduce reportTestTimestamp option and include timestamp for test sets and test cases#3261

Merged
olamy merged 4 commits intoapache:masterfrom
kevinnammour:reportStartTimestamp
Mar 2, 2026
Merged

Introduce reportTestTimestamp option and include timestamp for test sets and test cases#3261
olamy merged 4 commits intoapache:masterfrom
kevinnammour:reportStartTimestamp

Conversation

@kevinnammour
Copy link
Contributor

@kevinnammour kevinnammour commented Feb 14, 2026

New feature, improvement proposal

Issue
Enhacement issue: Add Test Start Timestamp to Surefire XML Reports #3249

Summary

Introduce an explicit test timestamp field in XML reports at both the testsuite and testcase levels. This enhancement will allow each test suite and individual test case to record the precise processing time of execution.

The addition of test timestamps makes it easier to correlate test execution events with external, time-based system metrics such as CPU usage, memory consumption, I/O activity, JVM metrics, and other system-level monitoring data.

The timestamp:

  • Represent the exact processing time of execution for each test suite and test case
  • Use ISO‑8601 format (UTC) for interoperability
  • Only shown when reportTestTimestamp is set to true

Motivation & Use Cases
This makes it easier to correlate test execution with time-based external signals, such as:

  • CPU usage
  • memory consumption
  • I/O pressure
  • JVM metrics
  • system-level monitoring data

Report Example

<testsuite
    name="com.example.MyTest"
    timestamp="2026-01-29T06:41:12.345Z"
    time="12.345">
<testcase
    name="shouldProcessData"
    classname="com.example.MyTest"
    timestamp="2026-01-29T06:41:15.123Z"
    time="0.456">
.......

Following this checklist to help us incorporate your contribution quickly and easily:

  • Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its clean install).

If your pull request is about ~20 lines of code you don't need to sign an Individual Contributor License Agreement if you are unsure please ask on the developers list.

To make clear that you license your contribution under the Apache License Version 2.0, January 2004 you have to acknowledge this by using the following check-box.

@kevinnammour kevinnammour marked this pull request as ready for review February 14, 2026 19:22
@kevinnammour
Copy link
Contributor Author

Hi @olamy, this is the PR we discussed a couple of weeks ago about the test timestamp reporting, please take a look when ur free.

Copy link
Contributor

@elharo elharo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, but major new features should start with an issue, not a PR

Copy link
Contributor

@elharo elharo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are any user doc updates required for this?

@kevinnammour
Copy link
Contributor Author

Sounds good, but major new features should start with an issue, not a PR

Hi @elharo, this enhancement was reported in this issue: #3249 through which we were invited to open a PR in case we couldn't rely on the custom reporters.

@elharo
Copy link
Contributor

elharo commented Feb 23, 2026

Thanks. You need to include the issue in the PR description.

@aghoussaini
Copy link
Contributor

Can you add a "how to use" section? @kevinnammour

@olamy olamy linked an issue Feb 24, 2026 that may be closed by this pull request
@olamy olamy added the enhancement New feature or request label Feb 24, 2026
@olamy olamy added this to the 3.5.6 milestone Feb 24, 2026
Copy link
Member

@olamy olamy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks

@kevinnammour
Copy link
Contributor Author

Can you add a "how to use" section? @kevinnammour

Hello, it can be activated through the reportTestTimestamp config flag; and the parameter docs are automatically generated from the javadoc through the site goal, so no need for manual doc updates.

@kevinnammour kevinnammour requested a review from elharo February 25, 2026 06:38
@kevinnammour
Copy link
Contributor Author

Thanks guys, let me know if there's anything else needed from my side.

@olamy
Copy link
Member

olamy commented Mar 2, 2026

@kevinnammour I was on my way merging it but we probably need to update the xsd files? https://github.com/apache/maven-surefire/blob/master/maven-surefire-plugin/src/site/resources/xsd/surefire-test-report.xsd

Can you do it now or in a follow-up PR? because I will merge a big PR today so I wanted to merge yours first and resolve conflicts rather than force you to do it.
Please let me know

@kevinnammour
Copy link
Contributor Author

@kevinnammour I was on my way merging it but we probably need to update the xsd files? https://github.com/apache/maven-surefire/blob/master/maven-surefire-plugin/src/site/resources/xsd/surefire-test-report.xsd

Can you do it now or in a follow-up PR? because I will merge a big PR today so I wanted to merge yours first and resolve conflicts rather than force you to do it.
Please let me know

I can do it now. Thanks.

@olamy olamy self-assigned this Mar 2, 2026
@olamy olamy merged commit 0fba0ef into apache:master Mar 2, 2026
14 checks passed
olamy pushed a commit to olamy/maven-surefire that referenced this pull request Mar 2, 2026
…ets and test cases (apache#3261)

* Introduce reportTestTimestamp option and include start timestamps in XML reports

* Explicitly state deprecation reason of StatelessXmlReporter ctor, and inline toIsoInstant logic

* Make test/testset startAt getters package private, and remove sleep behavior in dummy tests

* Adapt surefire test report format to include timestamp field
@olamy
Copy link
Member

olamy commented Mar 2, 2026

@kevinnammour thanks for your work and your patience ;)

olamy added a commit that referenced this pull request Mar 2, 2026
…ets and test cases (#3261) (#3302)

* Introduce reportTestTimestamp option and include start timestamps in XML reports

* Explicitly state deprecation reason of StatelessXmlReporter ctor, and inline toIsoInstant logic

* Make test/testset startAt getters package private, and remove sleep behavior in dummy tests

* Adapt surefire test report format to include timestamp field

Co-authored-by: Kevin Nammour <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Test Start Timestamp to Surefire XML Reports

4 participants