Repository navigation
Add UnitTestContainer project capability - #440
Conversation
|
Hi Tomáš Matoušek (@tmat), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
TTYL, MSBOT; |
| --> | ||
|
|
||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <ItemGroup> |
There was a problem hiding this comment.
I believe this props file is only dropped into the netcoreapp folder of the package - so if the unit test is targeting net46, it won't have this capability. There's a different issue for which I think there should just be one props file - so maybe this is fine if that issue is fixed.
There was a problem hiding this comment.
Made changes to copy same props file for net45 and netcore.
|
OK to merge? |
|
Tomáš Matoušek (@tmat) we can add this capability into the mstestv2 nuget & raise PR for xunit as well. That is better since it will address other projects as well - like u said. comments? secondly - there is another build conditional support for test project that Nate McMaster (@natemcmaster) is referring in #441 - we should rationalize whether to add separate property like IsTestProject or simply depend on the project capability. |
|
sbaid Actually, as I learned the legacy projects doesn't support capabilities. Long term it's better but I believe we have telemetry reasons to add it to the test sdk. Srivatsn Narayanan (@srivatsn) for details. |
|
As I originally proposed in #441, would you also consider adding a global static property in addition to the addition of the ProjectCapability? ProjectCapability is fine for VS purposes, but it's a bit cumbersome to program with. MSBuild developers would have to know MSBuild and the expected values in ProjectCapability well enough to know they need to write something like this to determine if a project is a test project: <ItemGroup>
<_FilteredCapabilities Include="ProjectCapabilities" Condition="'%(Identity)'=='UnitTestContainer'" />
</ItemGroup>
<PropertyGroup>
<IsTestProject Condition="@(_FilteredCapabilities -> Count()) > 0">true</IsTestProject>
</PropertyGroup>It would be nice the SDK could just define |
|
Nate McMaster (@natemcmaster)'s point is valid - it's easier to do a property check. However VS also needs the capability as that's the common mechanism that the project system uses to light up components. I think having both is fine as well. |
|
Srivatsn Narayanan (@srivatsn) Tomáš Matoušek (@tmat) to close on the project capability - if we close on the name as pl note that test.sdk is only included in .net core templates - not in desktop templates. |
|
Tomáš Matoušek (@tmat) codito do u have any comments on adding |
|
|
|
|
should we not name it |
|
We are already using the name in LUT. I wonder if it would be useful to have both UnitTestContainer and TestContainer. The distinction is interesting for LUT, since we would likely want to ignore functional tests. Of course it's completely up to the user to make the distinction. |
|
If we add both we should also have IsTestProject and IsUnitTestProject. |
|
Manish Jayaswal (@ManishJayaswal) For opinion. |
|
pvlakshm (@pvlakshm) @piotrpMSFT looping in |
|
I think we should add |
|
I guess it would be ok to change the name to TestContainer, since LUT doesn't work for CPS based projects yet anyways. So we can change the code in LUT that checks for the capability without breaking anything. |
|
sbaid said:
This seems like it belongs in |
|
sbaid wrote:
+1. It will be consistent, The types of test projects are numerous (functional test, load test, generic test, ordered test etc..). Each individual template should provide additional distinctions (e.g. CUIT should provide |
|
Tomáš Matoušek (@tmat) Brad Wilson (@bradwilson) we can add this in
|
| <GenerateProgramFile Condition="'$(GenerateProgramFile)' == ''">true</GenerateProgramFile> | ||
| </PropertyGroup> | ||
|
|
||
| <!-- Output type for dotnet core test project should be exe. For full CLR it is Library by default. --> |
There was a problem hiding this comment.
This is a workaround for sdk bug. Can you please mention the bug here for tracking?
I guess the only caveat is all comparisons in the test csproj will return $(OutputType) to be Library since that's the default, and the targets are imported at the end.
There was a problem hiding this comment.
Added issues link.
|
LGTM |
| <GeneratedProgramFile Condition="'$(GeneratedProgramFile)' ==''">$(IntermediateOutputPath)$(MSBuildProjectName).Program$(DefaultLanguageSourceExtension)</GeneratedProgramFile> | ||
| <GenerateProgramFile Condition="'$(GenerateProgramFile)' == ''">true</GenerateProgramFile> | ||
| </PropertyGroup> | ||
|
|
There was a problem hiding this comment.
Please add the bug reference (dotnet/project-system#268) here. It will tell us why did we moved OutputType from props file target file. In future once the bug will get fixed we will revert it back.
…ft#440) * Add TestContainer Capability and IsTestProject prop. * Add Issues reference.
|
|
||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <ItemGroup> | ||
| <ProjectCapability Include="TestContainer" /> |
There was a problem hiding this comment.
I think you should be putting this in the packages themselves, I can install xUnit in a random project that doesn't have to be test project (in fact Brad mentioned they are enabling that in their new dotnet xunit runner).
We should get xUnit, NUnit, etc to all mark themselves as a TestContainer
There was a problem hiding this comment.
David Kean (@davkean) this was discussed earlier. Pl refer comments on feb 12th.
Brad Wilson (@bradwilson) it will be good to add TestContainer projectcapability in the xunit.runner.visualstudio nuget package. It will help .NET Fx (Full CLR) projects. For dotnet projects - Microsoft.Net.Test.Sdk is adding it. Can this be done for 2.3 release?
…jects, mark test projects with the IsTestProject property and include the TestContainer project capability. See microsoft/vstest#440

This capability is used to detect test projects.
Related issue: #394