-
Notifications
You must be signed in to change notification settings - Fork 325
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
Run tests only for test projects #1745
Conversation
/cc @dasMulli Thanks for idea 👍 #411 (comment) |
Btw I was protoyping a different idea where: each project exhibits a target to collect test assemblies. <Project>
<Target Name="CollectBuildTestOutput"
Condition="'$(TargetFramework)' != '' or '$(TargetPath)' != ''"
DependsOnTargets="Build"
Returns="@(TestAssembly)">
<ItemGroup>
<TestAssembly Include="$([System.IO.Path]::GetFullPath($(TargetPath)))" TargetFrameworkMoniker="$(TargetFrameworkMoniker)" />
</ItemGroup>
</Target>
<Target Name="CollectInnerBuildTestOutput"
Condition="'$(TargetFramework)' == '' and '$(TargetFrameworks)' != ''">
<ItemGroup>
<_InnerTestFramework Include="$(TargetFrameworks)" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFile)" Targets="CollectBuildTestOutput" Properties="TargetFramework=%(_InnerTestFramework.Identity)">
<Output TaskParameter="TargetOutputs" ItemName="TestAssembly" />
</MSBuild>
</Target>
<Target Name="CollectTestBuildOutput"
Condition="'$(IsTestProject)' == 'true'"
DependsOnTargets="CollectBuildTestOutput;CollectInnerBuildTestOutput"
Returns="@(TestAssembly)" />
</Project> then the solution collects the assemblies and calls <Target Name="VSTest">
<MSBuild Projects="@(ProjectReference)" Targets="CollectTestBuildOutput">
<Output TaskParameter="TargetOutputs" ItemName="TestAssembly" />
</MSBuild>
<Exec Command="dotnet vstest --Framework:%(TestAssembly.TargetFrameworkMoniker) @(TestAssembly,' ')"
StandardOutputImportance="high" />
</Target> |
(updated to fix it for multi-targeting projects) I have no idea how this behaves with multiple test runners or different runners in the same solution (or different versions of xunit etc.). |
(sry for spamming) I'm fine with however this is resolved to make typing |
Different test frameworks(NUnit, xUnit, MSTest V2,etc..) and version will be handled by vstest.console. |
<Target Name="CollectBuildTestOutput"
Condition="'$(TargetFramework)' != '' or '$(TargetPath)' != ''"
DependsOnTargets="Build"
Returns="@(TestAssembly)">
<ItemGroup>
<TestAssembly Include="$([System.IO.Path]::GetFullPath($(TargetPath)))" TargetFrameworkMoniker="$(TargetFrameworkMoniker)" />
</ItemGroup>
</Target> I'm just wondering can we avoid build ( |
I think there's a Alternatively: Build the solution form the outer |
@smadala contact me if you want any feedback, testing etc. (twitter, mail) |
@dasMulli Sure 😄 |
@smadala when and how will this be available? Ideally it’s in the next drop of the 2.1.x SDK. Failing that, the next 2.2.x SDK preview. Finally, more out of curiosity, is there a way to drop in a nightly build of just MS Build Core? |
(cherry picked from commit a2b4196)
* Verify NS.JSon is loaded appropriately in case of DisableAppDomain (#1740) * reverting back app domain culture setup * binding redirect for TW.Interfaces * Run net451 test for Newtonsoft dependency (cherry picked from commit 3cbab0b) * Run tests only for test projects (#1745) (cherry picked from commit a2b4196) * Upgrading the version of VSSDK Build tools nuget, because the older one is incompatible with the latest VSSDK. (#1761) (cherry picked from commit d391224) * Added linkes to all RFCs (#1743) Added links to all RFCs to address #1392. * refined link test to .NET Core CC RFC. * Update README.md (cherry picked from commit 4d89670) * Get latest extensions from VS d15.9stg branch (#1771) (cherry picked from commit d5c4415) * Add info log if try to run tests with no IsTestProject prop (#1778) * Add info log if try to run tests with no IsTestProject prop * Add message to resources * invert check (cherry picked from commit 3decca0)
* Avaliable in vstest in versions >= 15.9.0 (microsoft/vstest#1745)
* Avaliable in vstest in versions >= 15.9.0 (microsoft/vstest#1745)
* Avaliable in vstest in versions >= 15.9.0 (microsoft/vstest#1745)
Description
Related issue
#1129
#705
#411