Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 18, 2025

When test duration is null, it was being converted to TimeSpan.FromTicks(0) and displayed as "(0ms)", which is misleading since the duration is actually unknown, not zero.

Changes

  • TestApplicationHandler.cs: Pass null when testResult.Duration is not available instead of TimeSpan.FromTicks(0)
  • TerminalTestReporter.cs: Accept TimeSpan? in TestCompleted and RenderTestCompleted, only render duration when value is present
// Before
TimeSpan.FromTicks(testResult.Duration ?? 0)  // Shows "(0ms)" when null

// After  
testResult.Duration.HasValue ? TimeSpan.FromTicks(testResult.Duration.Value) : null  // Omits duration when null

Output changes from passed TestName (0ms) to passed TestName when duration is unavailable.

Original prompt

This section details on the original issue you should resolve

<issue_title>Test duration shouldn't be shown as 0 if no value was provided</issue_title>
<issue_description>Example:

TimeSpan.FromTicks(testResult.Duration ?? 0),

If duration was null, we show it as "0". That doesn't look correct. We shouldn't print the duration at all in this case, because it's simply unknown.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix display of test duration when no value is provided Fix test duration display to not show "(0ms)" when duration is unavailable Nov 18, 2025
Copilot AI requested a review from Youssef1313 November 18, 2025 12:41
Copilot finished work on behalf of Youssef1313 November 18, 2025 12:41
@Youssef1313 Youssef1313 marked this pull request as ready for review November 18, 2025 12:45
@Youssef1313 Youssef1313 enabled auto-merge (squash) November 18, 2025 12:46
@nohwnd nohwnd disabled auto-merge November 18, 2025 12:59
@nohwnd
Copy link
Member

nohwnd commented Nov 18, 2025

Feels to me more like an "error" state where it should say (unknown ms) or (? ms). Is there a legitimate reason for framework to not report the amount of time it took? And if the data are missing will the user notice without us telling them something is missing?

@Youssef1313
Copy link
Member

It's a test framework decision. In 99% of the cases, I think the data will be there.
I only hit it in our internal test framework for MSTest, and showing 0ms was misleading.

@nohwnd
Copy link
Member

nohwnd commented Nov 18, 2025

Ok

@nohwnd nohwnd enabled auto-merge (squash) November 18, 2025 13:14
@nohwnd nohwnd merged commit 861d938 into release/10.0.2xx Nov 19, 2025
23 of 26 checks passed
@nohwnd nohwnd deleted the copilot/fix-test-duration-display branch November 19, 2025 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test duration shouldn't be shown as 0 if no value was provided

4 participants