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

Unable to deserialize xml report due to non-standard date format #105

Open
pklgn opened this issue Apr 21, 2024 · 2 comments
Open

Unable to deserialize xml report due to non-standard date format #105

pklgn opened this issue Apr 21, 2024 · 2 comments

Comments

@pklgn
Copy link

pklgn commented Apr 21, 2024

I use the nunit spekt logger to generate a report on my unit tests. In order to read this report, I use the XmlSerilizer's deserialization capabilities in C#. Unfortunately, the date format in which the logger saves date is not standard (not follows ISO8601). The date is separated by an additional space, which makes it impossible to read the date through the XmlSerilizer (due to XML format) and forces you to write additional logic in the code for the correct parsing of the Datetime XML attribute. Is there any way to fix this, or at least find out the reason why it was decided to write the date in a non-standard format like in the line below:

private const string DateFormat = "yyyy-MM-ddT HH:mm:ssZ";

Let me show an example:

            <test-suite type="TestSuite" name="UnitTests" fullname="Example.UnitTests" total="42" passed="42" failed="0"
                        inconclusive="0" skipped="0" result="Passed" start-time="2024-04-21T19:37:28Z"
                        end-time="2024-04-21T 19:37:36Z">

If I manually change start-time value from 2024-04-21T 19:37:28Z, which is written by logger, to 2024-04-21T19:37:28Z, then I will have no error with start-time, but I will have an error with end-time

System.FormatException
The string '2024-04-17T 19:37:36Z' is not a valid AllXsd value.
@codito
Copy link
Collaborator

codito commented Apr 21, 2024

@pklgn this is a bug, we should follow UTC standard format. Would you like to create a fix PR?

@pklgn
Copy link
Author

pklgn commented Apr 21, 2024

@codito I will try to create a PR within a few days.

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

No branches or pull requests

2 participants