docs icon indicating copy to clipboard operation
docs copied to clipboard

wiki: invalid sample for NUnit 3.0

Open ghost opened this issue 7 years ago • 14 comments

https://github.com/nunit/docs/wiki/XML-Formats -> http://nunit.org/files/testresult_30.txt

e.g. of error: "environment" must be child of "test-suite", but in the sample its parent is "test-run"

There might be more errors, maybe add a more recent sample...

ghost avatar May 31 '18 12:05 ghost

@nunit/framework-team Would the best approach be to compare current framework code to the docs, or maybe to even come up with an XSD in the framework repo?

jnm2 avatar Jul 11 '18 00:07 jnm2

I say both. We already have an issue here and in the framework repo about the schema AFAICR

mikkelbu avatar Jul 11 '18 06:07 mikkelbu

@mikkelbu I have some extra time today. Was anyone else hoping to tackle it?

jnm2 avatar Jul 11 '18 15:07 jnm2

@jnm2 - The XSD issue has been sitting as something we think we should do but nobody wants to since 2014. I reckon it's all yours! ;-)

https://github.com/nunit/nunit-console/issues/13

ChrisMaddock avatar Jul 11 '18 15:07 ChrisMaddock

😆 Okay. Now I'm confused. I would have thought that the XML was driven totally by the framework, not the engine. Where am I looking to find the source of the XML generation then? In other words, which repo will the xsd reside in?

jnm2 avatar Jul 11 '18 16:07 jnm2

The XML per-assembly is created in the framework. The engine merges these multiple xml results into a single file (e.g. wraps them in a test-run element.)

I would imagine we'd want an xsd in both repos! I'm not sure if it's possible to support 'nested XSDs'?

ChrisMaddock avatar Jul 11 '18 16:07 ChrisMaddock

Okay! I'll put each thing as close to the defining code as possible. I believe you can include and import XSD, but I'd have to read up on it.

jnm2 avatar Jul 11 '18 16:07 jnm2

Sounds awesome! 😄

ChrisMaddock avatar Jul 11 '18 16:07 ChrisMaddock

Is there a target namespace we have used in the past?

I'm also leaning towards xs:all everywhere rather than xs:sequence, which gives us the freedom to change the order in which elements appear. Parsers would need to use a string lookup either way because some elements will have minOccurs="0". What do you think?

(I'm writing this with descriptiveness, not prescriptiveness, in mind.)

jnm2 avatar Jul 11 '18 16:07 jnm2

I'd agree - the structure should be important, the order, not so.

I don't know about namespaces. I think NUnit 2 used to have an XSD - might be worth taking a look over at nunit-legacy.

ChrisMaddock avatar Jul 11 '18 16:07 ChrisMaddock

Here's what I got so far, validates against real-world test XML from the Explore action:

https://github.com/jnm2/nunit/blob/xsd/src/NUnitFramework/framework/Schemas/Test.xsd#L1

That has to come first, because the result format extends this format. What do you think so far?

image

jnm2 avatar Jul 11 '18 18:07 jnm2

I'm not very familar with xsd myself, but looks good to start with! This doesn't cover any failure-cases right, yet? e.g. throwing an exception during explore?

ChrisMaddock avatar Jul 11 '18 18:07 ChrisMaddock

Oh, good question! I hadn't thought of that.

jnm2 avatar Jul 11 '18 18:07 jnm2

@ChrisMaddock Any exceptions thrown during explore are already covered by the normal result format. 👍

jnm2 avatar Jul 13 '18 02:07 jnm2