Skip to content

Templates: allow to choose between MSTest, NUnit and xUnit#3777

Merged
DamianEdwards merged 8 commits intomicrosoft:mainfrom
Evangelink:mstest-template
Apr 24, 2024
Merged

Templates: allow to choose between MSTest, NUnit and xUnit#3777
DamianEdwards merged 8 commits intomicrosoft:mainfrom
Evangelink:mstest-template

Conversation

@Evangelink
Copy link
Copy Markdown
Member

@Evangelink Evangelink commented Apr 17, 2024

Fixes #2908

cc @pavelhorak

Microsoft Reviewers: Open in CodeFlow

@ghost ghost added the area-templates label Apr 17, 2024
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Apr 17, 2024
@Evangelink
Copy link
Copy Markdown
Member Author

I wasn't able to validate the starter project template as there are many packages that cannot be restored (not from the test project) so I am not sure what I am doing wrong.

The call to build.cmd -pack was good.

@Evangelink Evangelink changed the title Templates: allow to chose MSTest instead of xUnit Templates: allow to choose MSTest instead of xUnit Apr 17, 2024
Evangelink and others added 3 commits April 18, 2024 09:48
@Evangelink Evangelink marked this pull request as ready for review April 22, 2024 14:32
@Evangelink Evangelink changed the title Templates: allow to choose MSTest instead of xUnit Templates: allow to choose between MSTest, NUnit and xUnit Apr 23, 2024
@DamianEdwards
Copy link
Copy Markdown
Member

@Evangelink FYI I'm going to pull down your fork and verify the package changes locally before approving

@DamianEdwards
Copy link
Copy Markdown
Member

Templates install from locally built package OK:

image

And they show up VS too:

image

Verifying what @phenning said that when we change template groupid for the xunit template, you end up with duplicate templates for xUnit if you have the template from the workload (old groupid) and template from the package (new groupid) both installed. This shouldn't be a concern in the real-world for customers though as installing the templates from a NuGet package isn't a mainstream scenario and the 8.0 and 8.1 workloads won't be side-by-side either (IIUC).

Option for test framework to use on the Starter template shows up in VS OK:

image

And the CLI too:

image

New Starter project with MSTest project works in VS:

image

Works from the CLI too via dotnet test:

image

For NUnit it seems we have a missing using:

image

But I think we actually want to change to NUnit's new assertion pattern:

image

xUnit option is missing the required [Fact] and Assert lines completely (and the PackageReference in the .csproj file):

image

Copy link
Copy Markdown
Member

@DamianEdwards DamianEdwards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes should fix the issues with the NUnit and xUnit options in the Starter template.

@dotnet-policy-service dotnet-policy-service Bot added the needs-author-action An issue or pull request that requires more info or actions from the author. label Apr 23, 2024
@phenning
Copy link
Copy Markdown
Member

phenning commented Apr 23, 2024 via email

Co-authored-by: Damian Edwards <damian@damianedwards.com>
@Evangelink
Copy link
Copy Markdown
Member Author

These changes should fix the issues with the NUnit and xUnit options in the Starter template.

Thanks @DamianEdwards! I totally forgot to redo the manual tests after the last few commits... Sorry and glad you tested it.

@dotnet-policy-service dotnet-policy-service Bot removed the needs-author-action An issue or pull request that requires more info or actions from the author. label Apr 24, 2024
Copy link
Copy Markdown
Member

@DamianEdwards DamianEdwards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for this!

@DamianEdwards DamianEdwards merged commit bedb5a2 into microsoft:main Apr 24, 2024
@timheuer timheuer added the breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. label Apr 25, 2024
@timheuer
Copy link
Copy Markdown
Member

/backport to release/8.0

@github-actions
Copy link
Copy Markdown
Contributor

Started backporting to release/8.0: https://github.com/dotnet/aspire/actions/runs/8854449410

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-templates breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for MSTest to Aspire test project templates

8 participants