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
Add initial support for Microsoft.Testing.Platform #403
base: main
Are you sure you want to change the base?
Conversation
<clear /> | ||
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> | ||
<add key="feedz.io/xunit/xunit" value="https://f.feedz.io/xunit/xunit/nuget/index.json" protocolVersion="3" /> | ||
<add key="local" value="C:\src\visualstudio.xunit\artifacts\packages\" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be kept, this is just a temp change for you to test locally (you'll need to update the path as you know).
public static void AddXunit(this ITestApplicationBuilder testApplicationBuilder, Func<IEnumerable<Assembly>> getTestAssemblies) | ||
{ | ||
XunitExtension extension = new(); | ||
testApplicationBuilder.AddRunSettingsService(extension); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This provides the runsettings support.
{ | ||
XunitExtension extension = new(); | ||
testApplicationBuilder.AddRunSettingsService(extension); | ||
testApplicationBuilder.AddTestCaseFilterService(extension); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This provides support for the vstest way of filtering tests.
DO NOT CHANGE THE GUID, IT'S A WELL KNOWN EXTENSION POINT AND THIS EXTENSION NEEDS TO BE REGISTERED AT THE END | ||
WE HAVE CODE INSIDE THE TASK 'TestingPlatformEntryPoint' TO ENSURE THE ORDER OF THE REGISTRATION BASED ON THIS GUID | ||
--> | ||
<TestingPlatformBuilderHook Include="17E773D9-071C-4C66-97DD-57A450BDB027" Condition=" $(GenerateTestingPlatformEntryPoint) == 'true' " > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allows Microsoft.Testing.Platform.MSBuild
to detect the hook to call so we can auto-generate the entry point.
@@ -1,11 +1,24 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<PropertyGroup> | |||
<EnableXunitRunner Condition=" '$(EnableXunitRunner)' == '' ">false</EnableXunitRunner> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll let you decide on the name, this is just an example.
@@ -18,8 +18,15 @@ | |||
<dependencies> | |||
<group targetFramework="net462"> | |||
<dependency id="Microsoft.TestPlatform.ObjectModel" version="$MicrosoftTestPlatformObjectModelVersion$" /> | |||
<dependency id="Microsoft.Testing.Extensions.Telemetry" version="$MicrosoftTestingPlatformVersion$" /> | |||
<dependency id="Microsoft.Testing.Extensions.VSTestBridge" version="$MicrosoftTestingPlatformVersion$" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is mixing tabs/spaces, you'll need to configure your editor to show whistespaces
@Evangelink When building the sample, I get a compile failure that looks like some kind of missing assembly/package reference:
If I set |
Looks like it might be package reference related. Converting this: <PackageReference Include="xunit.runner.visualstudio" Version="2.5.8-pre.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> to this: <PackageReference Include="xunit.runner.visualstudio" Version="2.5.8-pre.2" /> fixes the issue. So it looks like setting developmentDependency is probably wrong for .nuspec now. Next question to answer is: Will NuGet pick up changes to this during package upgrade and update the PackageReference appropriately? |
All three of these variants did not upgrade the package correctly:
That's pretty disappointing. That means we're on a failure path here unless we can somehow convince people to uninstall and then reinstall the package. 😞 |
Also, it looks like you're setting a value in the .targets file ( |
What are the plans for |
Why are .NET Framework tests run in x86 by default if the test project is compiled as AnyCPU?
|
Hey @bradwilson, Sorry for the delay in my replies, I am off and had some trouble finding some time to get back here. I'll resume work on 11th so will be fully available for sure at this stage.
I assume that this is telling to msbuild that all deps are only compile time deps and not runtime ones but for the runner we do need the platform + adapter to be available at runtime. I see you have created a ticket on NuGet, I will try to ping some people so we can see how we can unblock this. @baronfel would you have some info or contact about that?
As the name implies this is explicitly asking for the vstest mode. This is equivalent to Our goal is to be able to deprecate
We are not doing any change on our side, this seems to be MSBuild defaults that changed between netfx and netcore. |
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<!-- This GUID comes from Microsoft.Testing.Platform, do not modify --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GUID is actually just any random GUID but it needs to be unique across the various extensions registered through the hook.
@MarcoRossignoli just pointed out this ticket dotnet/sdk#3492 that confirms this is the "default" behavior and this is a change linked to the sdk style project. |
No worries, this isn't a rush situation. :) |
I ask because I use |
@bradwilson .NET 9 preview 2 includes a rework of the test-reporting infrastructure that does show testing progress, as well as ordered test result reporting directly in MSBuild. It's built on a tiny bit of a hack while the MSBuild team works on a proper progress/ephemeral message API for the MSBuild logging infrastructure, after which we should be able to use those new message types to implement nice CLI progress reporting and such. So it's coming, we're working on it :) |
We definitely want to work on and improve the interactive mode. As Chet is saying we have already started some work and we are also exploring some paths in parallel so we can decide what's best and most evolutive |
@Evangelink @MarcoRossignoli @baronfel Where is the source for |
Is the planned IPC for support inside Visual Studio/VS Code also going to be named pipes? If so, what is the equivalent of Why are all the types in |
I'm just going to start opening issues with these questions so they're not buried here, and others can contribute (and perhaps get the benefit of the answers). First set of issues: microsoft/testfx#2536 ("FailedTestNodeStateProperty should include the ability to report without an exception") |
FYI, I have a parallel prototype effort to integrate |
Fixes #402