You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of #3317. Supersedes #2594, whose schema is worth salvaging even though the branch is not.
Why now rather than in 2021
#2594 added an XSD but never wired it to anything: it shipped as a resource and was consumed only by a Kotlin test. Meanwhile validation itself was dead — XMLParser probed the SAX validation feature under an https identifier no parser recognises, so setValidating(true) was never reached. That is fixed in #3315, and the DTD is now genuinely enforced (warn by default). Only now does the choice of schema language actually change anything for users.
What to salvage
The XSD in #2594 is materially better than the Trang dump in #3240: attributes are typed, enumerations are hoisted into named simpleTypes reusable between suite and test, and the DTD prose is converted into real xsd:documentation. Extract it with gh pr diff 2594 --patch rather than reusing the branch, which is 494 commits behind and conflicts throughout — most of its diff is an unrelated rename of ~120 test resources, which is what actually killed it.
Scope
Update the schema: drop junit (removed from master since), add use-global-thread-pool and share-thread-pool-for-data-providers.
No targetNamespace.Add XSD file for validation #2594 added one without adding xmlns to any suite file, which makes a namespace-aware validator unable to resolve <suite> — almost certainly why its data provider was red. A namespace is a breaking change for every existing testng.xml and is reserved for a future 2.0 of the schema.
Settle the cardinality question left open in review on Add XSD file for validation #2594: listeners / packages / method-selectors / suite-files should not be repeatable, and groups should join the choice so that validation stops depending on element order. That ordering constraint is the one real incompatibility the DTD imposes — it is why testng-all.xml had to be reordered in fix(xml): re-enable DTD validation and stop losing data in toXml() #3315, and it is what would bite users if the default moved to strict.
Ship the XSD next to the DTD. The DTD stays authoritative for files carrying a <!DOCTYPE>; the XSD becomes the contract the corpus test validates against and something IDEs can complete from.
Part of #3317. Supersedes #2594, whose schema is worth salvaging even though the branch is not.
Why now rather than in 2021
#2594 added an XSD but never wired it to anything: it shipped as a resource and was consumed only by a Kotlin test. Meanwhile validation itself was dead —
XMLParserprobed the SAX validation feature under anhttpsidentifier no parser recognises, sosetValidating(true)was never reached. That is fixed in #3315, and the DTD is now genuinely enforced (warnby default). Only now does the choice of schema language actually change anything for users.What to salvage
The XSD in #2594 is materially better than the Trang dump in #3240: attributes are typed, enumerations are hoisted into named
simpleTypes reusable betweensuiteandtest, and the DTD prose is converted into realxsd:documentation. Extract it withgh pr diff 2594 --patchrather than reusing the branch, which is 494 commits behind and conflicts throughout — most of its diff is an unrelated rename of ~120 test resources, which is what actually killed it.Scope
junit(removed from master since), adduse-global-thread-poolandshare-thread-pool-for-data-providers.targetNamespace. Add XSD file for validation #2594 added one without addingxmlnsto any suite file, which makes a namespace-aware validator unable to resolve<suite>— almost certainly why its data provider was red. A namespace is a breaking change for every existingtestng.xmland is reserved for a future 2.0 of the schema.listeners/packages/method-selectors/suite-filesshould not be repeatable, andgroupsshould join the choice so that validation stops depending on element order. That ordering constraint is the one real incompatibility the DTD imposes — it is whytestng-all.xmlhad to be reordered in fix(xml): re-enable DTD validation and stop losing data in toXml() #3315, and it is what would bite users if the default moved tostrict.<!DOCTYPE>; the XSD becomes the contract the corpus test validates against and something IDEs can complete from.testng-1.0.dtdwhile the reader always resolvedtestng-1.1.dtd(fixed in fix(xml): re-enable DTD validation and stop losing data in toXml() #3315).Done when
toXml()validates against the XSD, as it already must against the DTD.Note there is no need to rename or move any test resource for this. That is the mistake to avoid repeating.