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

incorrect time in nunit xml file #1879

Closed
sqlenders opened this issue Mar 19, 2021 · 5 comments · Fixed by #2208
Closed

incorrect time in nunit xml file #1879

sqlenders opened this issue Mar 19, 2021 · 5 comments · Fixed by #2208
Assignees
Milestone

Comments

@sqlenders
Copy link

General summary of the issue

The time in Nunit XML file is the local time. Not the UTC time. Therefor all my tests are run in the future.

Describe your environment

Pester version : 5.1.1 C:\Program Files\WindowsPowerShell\Modules\Pester\5.1.1\Pester.psm1
PowerShell version : 5.1.14409.1018
OS version : Microsoft Windows NT 6.3.9600.0

Steps to reproduce

Run any test and create a nunit.xml file.
Look at the second line and in the end you will see the time. This time is my local time (CET) and not the UTC time
When uploading this file to azure devops, it assumes it is UTC and all my tests are now in the future.

Expected Behavior

test-results xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="nunit_schema_2.5.xsd" name="Pester" total="62" errors="0" failures="0" not-run="92" inconclusive="0" ignored="0" skipped="0" invalid="0" date="2021-03-19" time="18:25:01"

Current Behavior

test-results xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="nunit_schema_2.5.xsd" name="Pester" total="62" errors="0" failures="0" not-run="92" inconclusive="0" ignored="0" skipped="0" invalid="0" date="2021-03-19" time="19:25:01"

Possible Solution? (optional)

Convert the time to UTC time. Powershell has some functions for it.
Something like
$TimeNow = Get-Date
get-date $TimeNow -f "MMddyy HH:mm:ss"
$TimeNow.ToUniversalTime().ToString("MMddyy HH:mm:ss")

@fflaten
Copy link
Collaborator

fflaten commented Mar 20, 2021

Is UTC standard in NUnit-reports or Azure DevOps-specific? I'm wondering if a default change would break most CI.
Can't find a time-zone requirement for NUnit2.5 which we use, but NUnit3 XML-format specifies UTC:

start-time The UTC time that the test run started.
end-time The UTC time that the test run ended.

https://docs.nunit.org/articles/nunit/technical-notes/usage/Test-Result-XML-Format.html

Pester uses local time in both NUnit2.5-report and Passthru-object. Should UTC be a global option in PesterConfiguration-maybe?

@nohwnd nohwnd added this to the 5.3 milestone Mar 22, 2021
@nohwnd
Copy link
Member

nohwnd commented Mar 22, 2021

I think we should finally move to the latest nunit xml format. It's way better specified than 2.5. Adding to next milestone as it is a quite big task.

@nohwnd
Copy link
Member

nohwnd commented Jun 21, 2021

nunit/nunit#3879 (comment) check this for the latest nunit docs.

@nohwnd
Copy link
Member

nohwnd commented Jun 27, 2021

@fflaten do you want to work on this in this milestone (maybe two more weeks before "final" beta?) or should I move it to the next one.

@fflaten
Copy link
Collaborator

fflaten commented Jun 27, 2021

Might not make this one but it'll try. Worked on nunit3 a couple of days ago, but it's been a busy week.

@fflaten fflaten modified the milestones: 5.3, NUnit 3 Jul 3, 2022
@fflaten fflaten self-assigned this Apr 15, 2023
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 a pull request may close this issue.

3 participants