Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is Duration, startTime and endTime in trx report? #4156

Closed
vadim-96 opened this issue Feb 5, 2021 · 2 comments
Closed

What is Duration, startTime and endTime in trx report? #4156

vadim-96 opened this issue Feb 5, 2021 · 2 comments

Comments

@vadim-96
Copy link

vadim-96 commented Feb 5, 2021

Steps to reproduce

Just generate trx file with following command: dotnet test --filter Category=Test --logger:trx;LogFileName=results.trx

Environment

  • Windows 10 x64, NET 5.0, Visual Studio Community 16.8.4
  • SpecFlow 3.6.23, SpecFlow.Tools.MsBuild.Generation 3.6.23, SpecFlow.xUnit 3.6.23, xunit.runner.visualstudio 2.4.3, Microsoft.NET.Test.Sdk 16.8.3, FluentAssertions 5.10.3

In trx file I can see following sections: duration, startTime, endTime. I couldn't figure out how the time is calculated?
trx
I found these fields in code: https://github.com/microsoft/testfx/blob/ec18af6f90c272f68f48d9d0b94c71b8e276c7a0/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs#L376
https://github.com/microsoft/testfx/blob/ec18af6f90c272f68f48d9d0b94c71b8e276c7a0/src/Adapter/MSTest.CoreAdapter/Execution/TestMethodInfo.cs#L159

@nohwnd nohwnd added the triaged label Jun 15, 2021
@nohwnd nohwnd self-assigned this Jun 15, 2021
@Evangelink Evangelink transferred this issue from microsoft/testfx Nov 30, 2022
@nohwnd
Copy link
Member

nohwnd commented Jan 16, 2023

Start time and End time are set to current timestamp when they are not provided by the adapter. XUnit does not provide that information, it only provides duration, so the start and end time timestamps are incorrect. We could possibly calculate start time from duration, but then it would be hard to distinguish from the case where the adapter provided correct start time and incorrect duration. Or incorrect start time and correct duration, in both cases the numbers would not add up.

@vadim-96
Copy link
Author

Ok I got it, thank you for your answer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants