Skip to content
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

MSTest.Sdk handles library mode #3581

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Package/MSTest.Sdk/Sdk/Features/Aspire.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<ItemGroup>
<PackageReference Include="Aspire.Hosting.Testing" Version="$(AspireHostingTestingVersion)" VersionOverride="$(AspireHostingTestingVersion)" Sdk="MSTest" />
<PackageReference Include="Aspire.Hosting.Testing" Sdk="MSTest"
Version="$(AspireHostingTestingVersion)" VersionOverride="$(AspireHostingTestingVersion)" />
</ItemGroup>

<!--
Expand Down
3 changes: 2 additions & 1 deletion src/Package/MSTest.Sdk/Sdk/Features/Playwright.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<ItemGroup>
<PackageReference Include="Microsoft.Playwright.MSTest" Version="$(MicrosoftPlaywrightVersion)" VersionOverride="$(MicrosoftPlaywrightVersion)" Sdk="MSTest" />
<PackageReference Include="Microsoft.Playwright.MSTest" Sdk="MSTest"
Version="$(MicrosoftPlaywrightVersion)" VersionOverride="$(MicrosoftPlaywrightVersion)" />
</ItemGroup>

<!--
Expand Down
49 changes: 35 additions & 14 deletions src/Package/MSTest.Sdk/Sdk/Runner/ClassicEngine.targets
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,50 @@

<!-- Core -->
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" VersionOverride="$(MicrosoftNETTestSdkVersion)" Sdk="MSTest" />
<PackageReference Include="MSTest.TestFramework" Sdk="MSTest"
Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)" />
<PackageReference Include="MSTest.Analyzers" Sdk="MSTest"
Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)"
Condition=" '$(EnableMSTestAnalyzers)' != 'false' " />
</ItemGroup>

<!-- Core (for test applications - not for test libraries) -->
<ItemGroup Condition=" '$(IsTestLibrary)' != 'true' ">
<PackageReference Include="Microsoft.NET.Test.Sdk" Sdk="MSTest"
Version="$(MicrosoftNETTestSdkVersion)" VersionOverride="$(MicrosoftNETTestSdkVersion)" />
<!--
Most of the times this dependency is not required but we leave the opportunity to align the version of the platform being used.
At the moment this is mainly used for our acceptance tests because the locally/CI built version ends with -dev or -ci which is
considered by NuGet resolver as older than any -preview version. Using this property we can ensure the local version is being
selected.
-->
<PackageReference Include="Microsoft.Testing.Platform" Version="$(MicrosoftTestingPlatformVersion)" VersionOverride="$(MicrosoftTestingPlatformVersion)" Sdk="MSTest"
<PackageReference Include="Microsoft.Testing.Platform" Sdk="MSTest"
Version="$(MicrosoftTestingPlatformVersion)" VersionOverride="$(MicrosoftTestingPlatformVersion)"
Condition=" '$(EnableMicrosoftTestingPlatform)' == 'true' " />
<PackageReference Include="MSTest.TestAdapter" Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)" Sdk="MSTest" />
<PackageReference Include="MSTest.TestFramework" Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)" Sdk="MSTest" />
<PackageReference Include="MSTest.Analyzers" Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)" Sdk="MSTest"
Condition=" '$(EnableMSTestAnalyzers)' != 'false' " />
<PackageReference Include="MSTest.TestAdapter" Sdk="MSTest"
Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)" />
</ItemGroup>

<!-- Extensions -->
<ItemGroup>
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="$(MicrosoftTestingExtensionsTrxReportVersion)" VersionOverride="$(MicrosoftTestingExtensionsTrxReportVersion)" Condition=" '$(EnableMicrosoftTestingExtensionsTrxReport)' == 'true' " Sdk="MSTest" />
<PackageReference Include="Microsoft.Testing.Extensions.CrashDump" Version="$(MicrosoftTestingExtensionsCrashDumpVersion)" VersionOverride="$(MicrosoftTestingExtensionsCrashDumpVersion)" Condition=" '$(EnableMicrosoftTestingExtensionsCrashDump)' == 'true' " Sdk="MSTest" />
<PackageReference Include="Microsoft.Testing.Extensions.HangDump" Version="$(MicrosoftTestingExtensionsHangDumpVersion)" VersionOverride="$(MicrosoftTestingExtensionsHangDumpVersion)" Condition=" '$(EnableMicrosoftTestingExtensionsHangDump)' == 'true' " Sdk="MSTest" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="$(MicrosoftTestingExtensionsCodeCoverageVersion)" VersionOverride="$(MicrosoftTestingExtensionsCodeCoverageVersion)" Condition=" '$(EnableMicrosoftTestingExtensionsCodeCoverage)' == 'true' " Sdk="MSTest" />
<PackageReference Include="Microsoft.Testing.Extensions.HotReload" Version="$(MicrosoftTestingExtensionsHotReloadVersion)" VersionOverride="$(MicrosoftTestingExtensionsHotReloadVersion)" Condition=" '$(EnableMicrosoftTestingExtensionsHotReload)' == 'true' " Sdk="MSTest" />
<PackageReference Include="Microsoft.Testing.Extensions.Retry" Version="$(MicrosoftTestingExtensionsRetryVersion)" VersionOverride="$(MicrosoftTestingExtensionsRetryVersion)" Condition=" '$(EnableMicrosoftTestingExtensionsRetry)' == 'true' " Sdk="MSTest" />
<!-- Extensions (for test applications - not for test libraries) -->
<ItemGroup Condition=" '$(IsTestLibrary)' != 'true' ">
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Sdk="MSTest"
Version="$(MicrosoftTestingExtensionsTrxReportVersion)" VersionOverride="$(MicrosoftTestingExtensionsTrxReportVersion)"
Condition=" '$(EnableMicrosoftTestingExtensionsTrxReport)' == 'true' " />
<PackageReference Include="Microsoft.Testing.Extensions.CrashDump" Sdk="MSTest"
Version="$(MicrosoftTestingExtensionsCrashDumpVersion)" VersionOverride="$(MicrosoftTestingExtensionsCrashDumpVersion)"
Condition=" '$(EnableMicrosoftTestingExtensionsCrashDump)' == 'true' " />
<PackageReference Include="Microsoft.Testing.Extensions.HangDump" Sdk="MSTest"
Version="$(MicrosoftTestingExtensionsHangDumpVersion)" VersionOverride="$(MicrosoftTestingExtensionsHangDumpVersion)"
Condition=" '$(EnableMicrosoftTestingExtensionsHangDump)' == 'true' " />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Sdk="MSTest"
Version="$(MicrosoftTestingExtensionsCodeCoverageVersion)" VersionOverride="$(MicrosoftTestingExtensionsCodeCoverageVersion)"
Condition=" '$(EnableMicrosoftTestingExtensionsCodeCoverage)' == 'true' " />
<PackageReference Include="Microsoft.Testing.Extensions.HotReload" Sdk="MSTest"
Version="$(MicrosoftTestingExtensionsHotReloadVersion)" VersionOverride="$(MicrosoftTestingExtensionsHotReloadVersion)"
Condition=" '$(EnableMicrosoftTestingExtensionsHotReload)' == 'true' " />
<PackageReference Include="Microsoft.Testing.Extensions.Retry" Sdk="MSTest"
Version="$(MicrosoftTestingExtensionsRetryVersion)" VersionOverride="$(MicrosoftTestingExtensionsRetryVersion)"
Condition=" '$(EnableMicrosoftTestingExtensionsRetry)' == 'true' " />
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)../Features/Aspire.targets" Condition=" '$(EnableAspireTesting)' == 'true' " />
Expand Down
4 changes: 3 additions & 1 deletion src/Package/MSTest.Sdk/Sdk/Runner/Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

<PropertyGroup>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
<OutputType Condition=" '$(OutputType)' == '' ">Exe</OutputType>
<IsTestLibrary Condition=" '$(OutputType)' == 'Library' ">true</IsTestLibrary>
<IsTestLibrary Condition=" '$(OutputType)' != 'Library' ">false</IsTestLibrary>
<MicrosoftTestingExtensionsCommonVersion Condition=" '$(MicrosoftTestingExtensionsCommonVersion)' == '' " >$(MicrosoftTestingPlatformVersion)</MicrosoftTestingExtensionsCommonVersion>
<TestingPlatformDotnetTestSupport Condition=" $(TestingPlatformDotnetTestSupport) == '' ">true</TestingPlatformDotnetTestSupport>
<TestingExtensionsProfile Condition=" $(TestingExtensionsProfile) == '' ">Default</TestingExtensionsProfile>
Expand Down
24 changes: 17 additions & 7 deletions src/Package/MSTest.Sdk/Sdk/Runner/NativeAOT.targets
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,28 @@

<!-- Core -->
<ItemGroup>
<PackageReference Include="Microsoft.Testing.Platform.MSBuild" Version="$(MicrosoftTestingPlatformVersion)" VersionOverride="$(MicrosoftTestingPlatformVersion)" Sdk="MSTest" />
<PackageReference Include="MSTest.TestFramework" Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)" Sdk="MSTest" />
<PackageReference Include="MSTest.Engine" Version="$(MSTestEngineVersion)" VersionOverride="$(MSTestEngineVersion)" Sdk="MSTest" />
<PackageReference Include="MSTest.SourceGeneration" Version="$(MSTestEngineVersion)" VersionOverride="$(MSTestEngineVersion)" Sdk="MSTest" />
<PackageReference Include="Microsoft.Testing.Platform.MSBuild" Sdk="MSTest"
Version="$(MicrosoftTestingPlatformVersion)" VersionOverride="$(MicrosoftTestingPlatformVersion)" />
<PackageReference Include="MSTest.TestFramework" Sdk="MSTest"
Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)" />
<PackageReference Include="MSTest.Engine" Sdk="MSTest"
Version="$(MSTestEngineVersion)" VersionOverride="$(MSTestEngineVersion)" />
<PackageReference Include="MSTest.SourceGeneration" Sdk="MSTest"
Version="$(MSTestEngineVersion)" VersionOverride="$(MSTestEngineVersion)" />
</ItemGroup>

<!-- Extensions -->
<ItemGroup>
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="$(MicrosoftTestingExtensionsTrxReportVersion)" VersionOverride="$(MicrosoftTestingExtensionsTrxReportVersion)" Condition=" '$(EnableMicrosoftTestingExtensionsTrxReport)' == 'true' " Sdk="MSTest" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="$(MicrosoftTestingExtensionsCodeCoverageVersion)" VersionOverride="$(MicrosoftTestingExtensionsCodeCoverageVersion)" Condition=" '$(EnableMicrosoftTestingExtensionsCodeCoverage)' == 'true' " Sdk="MSTest" />
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Sdk="MSTest"
Version="$(MicrosoftTestingExtensionsTrxReportVersion)" VersionOverride="$(MicrosoftTestingExtensionsTrxReportVersion)"
Condition=" '$(EnableMicrosoftTestingExtensionsTrxReport)' == 'true' " />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Sdk="MSTest"
Version="$(MicrosoftTestingExtensionsCodeCoverageVersion)" VersionOverride="$(MicrosoftTestingExtensionsCodeCoverageVersion)"
Condition=" '$(EnableMicrosoftTestingExtensionsCodeCoverage)' == 'true' " />
<!-- Support for -p:AotMsCodeCoverageInstrumentation="true" during dotnet publish for native aot -->
<PackageReference Include="Microsoft.CodeCoverage.MSBuild" Version="$(MicrosoftTestingExtensionsCodeCoverageVersion)" VersionOverride="$(MicrosoftTestingExtensionsCodeCoverageVersion)" Condition=" '$(EnableMicrosoftTestingExtensionsCodeCoverage)' == 'true' and $(PublishAot) == 'true' " Sdk="MSTest" />
<PackageReference Include="Microsoft.CodeCoverage.MSBuild" Sdk="MSTest"
Version="$(MicrosoftTestingExtensionsCodeCoverageVersion)" VersionOverride="$(MicrosoftTestingExtensionsCodeCoverageVersion)"
Condition=" '$(EnableMicrosoftTestingExtensionsCodeCoverage)' == 'true' and $(PublishAot) == 'true' " />
</ItemGroup>

</Project>
23 changes: 19 additions & 4 deletions src/Package/MSTest.Sdk/Sdk/VSTest/VSTest.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,27 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" VersionOverride="$(MicrosoftNETTestSdkVersion)" Sdk="MSTest" />
<PackageReference Include="MSTest.TestAdapter" Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)" Sdk="MSTest" />
<PackageReference Include="MSTest.TestFramework" Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)" Sdk="MSTest" />
<PackageReference Include="MSTest.Analyzers" Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)" Condition=" '$(EnableMSTestAnalyzers)' != 'false' " Sdk="MSTest" />
<PackageReference Include="MSTest.TestFramework" Sdk="MSTest"
Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)" />
<PackageReference Include="MSTest.Analyzers" Sdk="MSTest"
Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)"
Condition=" '$(EnableMSTestAnalyzers)' != 'false' " />
</ItemGroup>

<!-- If we are a test application (not a test library) -->
<ItemGroup Condition=" '$(IsTestLibrary)' != 'true' ">
<PackageReference Include="Microsoft.NET.Test.Sdk" Sdk="MSTest"
Version="$(MicrosoftNETTestSdkVersion)" VersionOverride="$(MicrosoftNETTestSdkVersion)" />
<PackageReference Include="MSTest.TestAdapter" Sdk="MSTest"
Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)" />
<PackageReference Include="MSTest.TestFramework" Sdk="MSTest"
Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)" />
<PackageReference Include="MSTest.Analyzers" Sdk="MSTest"
Version="$(MSTestVersion)" VersionOverride="$(MSTestVersion)"
Condition=" '$(EnableMSTestAnalyzers)' != 'false' " />
</ItemGroup>


<!--
Implicit imports
Ensure feature is available and user hasn't opted-out from it.
Expand Down
Loading