Add xUnit V3 project variants for shared tests/tools other repos consume.#9876
Add xUnit V3 project variants for shared tests/tools other repos consume.#9876MichaelSimons merged 3 commits intodotnet:mainfrom
Conversation
Introduce new XunitV3 copies of the packable test infrastructure assemblies (Microsoft.TemplateEngine.TestHelper.XunitV3 and Microsoft.TemplateEngine.Mocks.XunitV3) to enable downstream repos (sdk, aspnet, wpf) to incrementally adopt xUnit v3. - Add xunit.v3 and Verify.XunitV3 package versions to Directory.Packages.props - Add #if XUNIT_V3 preprocessor guards in shared source files where v2/v3 APIs differ (namespace changes, new ITestOutputHelper members, nullable GetValue returns) - New .XunitV3 projects compile the same source with XUNIT_V3 defined - Existing v2 projects remain unchanged Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…heir tests Create XunitV3 duplicates of TemplateVerifier, TemplateApiVerifier, and their UnitTests and IntegrationTests projects. Use shared .props files to minimize duplication between V2 and V3 project definitions. - Extract common properties, package refs, and project refs into Shared.props files for all 4 project pairs - V3 projects link source from V2 via Compile Include and define XUNIT_V3 constant - V3 TemplateVerifier uses Verify.XunitV3 + xunit.v3 packages - V3 TemplateApiVerifier swaps project refs to V3 versions shared CommandUtils files and test source files - V3 tools projects share PublicAPI.*.txt from V2 via AdditionalFiles Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
df38f78 to
0e377b9
Compare
|
@baronfel - FYI - I took your suggestion of creating V3 versions of the shared components to prevent blocking dependency flows allowing downstream repo devs to pick up these changes on their time schedule. Thanks |
baronfel
left a comment
There was a problem hiding this comment.
Thank you for taking this on!
|
We will probably need to do something to ensure the new packages are pushed to the various nightly feeds? |
I wasn't expecting anything special - the publish properties are set correctly - I didn't spot any special handling of the v2 project. Arcade should handle everything else. ....but I am not an expert in this space. |
|
@MichaelSimons when will this new package be published? |
I would expect 11.0 preview 3. They are available now in the VMR latest builds. |
Motivation
Several projects in this repo — TemplateVerifier, TemplateApiVerifier, TestHelper, and Mocks — are consumed by other repositories (e.g. ASP.NET, SDK). If the entire templating repo were updated to xUnit V3 at once, it would force all consuming repos to adopt V3 simultaneously, blocking dependency flow. Instead, this PR takes an incremental approach: publish V3 variants of the shared components first so that downstream consumers can migrate to V3 on their own schedule, then finish converting the rest of this repo afterward.
Summary
Adds xUnit V3 versions of the TemplateVerifier, TemplateApiVerifier, TestHelper, Mocks, and their test projects alongside the existing V2 versions. The V2 projects remain unchanged forexternal consumers. Introduces shared
.propsfiles across all V2/V3 project pairs to minimize duplication.New projects
Microsoft.TemplateEngine.Authoring.TemplateVerifier.XunitV3Microsoft.TemplateEngine.Authoring.TemplateApiVerifier.XunitV3Microsoft.TemplateEngine.Authoring.TemplateVerifier.UnitTests.XunitV3Microsoft.TemplateEngine.Authoring.TemplateVerifier.IntegrationTests.XunitV3Microsoft.TemplateEngine.TestHelper.XunitV3Microsoft.TemplateEngine.Mocks.XunitV3New shared
.propsfilesTemplateVerifier.Shared.propsTemplateApiVerifier.Shared.propsTestHelper.Shared.propsMocks.Shared.propsApproach
.propsfiles extract commonPropertyGroup,PackageReference, andProjectReferenceitems so that V2 and V3.csprojfiles only contain what differs (xunit package versions andXUNIT_V3define).<Compile Include>— no code duplication.PublicAPI.*.txtfiles are shared via<AdditionalFiles>where the public API surface is identical (TemplateVerifier, TemplateApiVerifier). TestHelper keeps separate files due to xunit namespace differences.#if !XUNIT_V3conditionals added where xunit V2/V3 APIs differ:Xunit.Abstractions→ auto-imported in V3 (shared CommandUtils files)UseVerifyAttributeremoved inVerify.XunitV3(VerificationEngine.cs)Directory.Packages.props:Verify.XunitV3,xunit.v3.assert,xunit.v3.extensibility.core.Related to #9869 and dotnet/sdk#52914