Skip to content

Add unit test project #3380

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

Merged
merged 21 commits into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a929667
Add unit test project
mdaigle May 27, 2025
2a36221
Add test that uses internal type
mdaigle May 27, 2025
1b953ef
Add missing tools projects when compiling unit tests proj.
mdaigle May 28, 2025
306e50e
Add ref project references when compiling unit test project in 'Proje…
mdaigle May 28, 2025
44e167e
Remove ref proj references.
mdaigle May 28, 2025
9b0ccf5
Prevent auto-generated reference assemblies.
mdaigle May 28, 2025
5c6351f
Add unit tests to test running step. Fix functional test project name.
mdaigle May 28, 2025
2eaf5d2
Run unit tests for linux and mac
mdaigle May 28, 2025
d2f29b9
Merge branch 'main' into add-unit-test-project
mdaigle Jun 2, 2025
071d14a
Remove unneeded references.
mdaigle Jun 3, 2025
3e981e0
Merge branch 'add-unit-test-project' of github.com:dotnet/SqlClient i…
mdaigle Jun 3, 2025
7b175fd
Remove additional references. Add back required test sdk reference.
mdaigle Jun 4, 2025
51a46b6
Merge branch 'main' into add-unit-test-project
mdaigle Jun 4, 2025
553caf6
Set InternalsVisibleTo attribute in netfx csproj.
mdaigle Jun 4, 2025
14097d7
Limit unit tests to project reference type builds. Clean up unneeded …
mdaigle Jun 4, 2025
73dbec0
Merge branch 'add-unit-test-project' of github.com:dotnet/SqlClient i…
mdaigle Jun 4, 2025
aa4cbbf
Remove duplicate target
mdaigle Jun 4, 2025
8deac75
Remove internal types from ref.
mdaigle Jun 4, 2025
4226beb
Revert formatting changes do reduce diff.
mdaigle Jun 4, 2025
294c406
Disable UnitTest targets and skip unit test stages when using package…
mdaigle Jun 5, 2025
042ee13
Merge main
mdaigle Jun 5, 2025
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
75 changes: 66 additions & 9 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,19 @@
<NetStandardDriver Include="**/netcore/ref/Microsoft.Data.SqlClient*.csproj" />
<AKVProvider Include="**/add-ons/**/AzureKeyVaultProvider/*.csproj" />

<UnitTests Include="**/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj" />
<UnitTestsProj Include="**/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj" />

<FunctionalTests Include="**/Common/Common.csproj" />
<FunctionalTests Include="**/tools/TDS/TDS/TDS.csproj" />
<FunctionalTests Include="**/tools/TDS/TDS.EndPoint/TDS.EndPoint.csproj" />
<FunctionalTests Include="**/tools/TDS/TDS.Servers/TDS.Servers.csproj" />
<FunctionalTests Include="**/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj" />
<FunctionalTests Include="**/tools/CoreFx.Private.TestUtilities/CoreFx.Private.TestUtilities.csproj" />
<FunctionalTests Include="**/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj" />
<FunctionalTests Include="**/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj" />
<FunctionalTestsProj Include="**/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj" />

<FunctionalTests Include="**/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj" />
<FunctionalTestsProj Include="**/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj" />
<ManualTests Include="**/Common/Common.csproj" />
<ManualTests Include="**/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj" />
<ManualTests Include="**/ManualTests/SQL/UdtTest/UDTs/Circle/Circle.csproj" />
Expand All @@ -84,10 +87,10 @@
<Target Name="Restore" DependsOnTargets="RestoreSqlServerLib;RestoreNetCore;RestoreNetFx" />
<Target Name="BuildAll" DependsOnTargets="BuildSqlServerLib;BuildNetFx;BuildNetCore;BuildNetStandard" />
<Target Name="BuildAllConfigurations" DependsOnTargets="Restore;BuildTools;BuildSqlServerLib;BuildNetFx;BuildNetCoreAllOS;BuildNetStandard;GenerateNugetPackage" />
<Target Name="BuildSqlServerPackage" DependsOnTargets="BuildSqlServerLibAnyOS;GenerateSqlServerPackage" />
<Target Name="BuildTestsNetCore" DependsOnTargets="RestoreTestsNetCore;BuildAKVNetCore;BuildFunctionalTestsNetCore;BuildManualTestsNetCore" />
<Target Name="BuildTestsNetFx" DependsOnTargets="RestoreTestsNetFx;BuildAKVNetFx;BuildFunctionalTestsNetFx;BuildManualTestsNetFx" Condition="$(IsEnabledWindows) == 'true'" />
<Target Name="BuildTests" DependsOnTargets="BuildTestsNetCore;BuildTestsNetFx" />
<Target Name="BuildSqlServerPackage" DependsOnTargets="BuildSqlServerLibAnyOS;GenerateSqlServerPackage"/>
<Target Name="BuildTestsNetCore" DependsOnTargets="RestoreTestsNetCore;BuildAKVNetCore;BuildUnitTestsNetCore;BuildFunctionalTestsNetCore;BuildManualTestsNetCore"/>
<Target Name="BuildTestsNetFx" DependsOnTargets="RestoreTestsNetFx;BuildAKVNetFx;BuildUnitTestsNetFx;BuildFunctionalTestsNetFx;BuildManualTestsNetFx" Condition="$(IsEnabledWindows) == 'true'"/>
<Target Name="BuildTests" DependsOnTargets="BuildTestsNetCore;BuildTestsNetFx"/>

<Target Name="RestoreSqlServerLib">
<MSBuild Projects="@(SqlServerLib)" Targets="restore" />
Expand All @@ -100,6 +103,7 @@
<Target Name="RestoreTestsNetCore">
<MSBuild Projects="@(ManualTests)" Targets="restore" Properties="$(TestProjectProperties)" />
<MSBuild Projects="@(FunctionalTests)" Targets="restore" Properties="$(TestProjectProperties)" />
<MSBuild Projects="@(UnitTests)" Targets="restore" Properties="$(TestProjectProperties)"/>
</Target>

<Target Name="RestoreNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
Expand All @@ -109,6 +113,7 @@
<Target Name="RestoreTestsNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
<MSBuild Projects="@(ManualTests)" Targets="restore" Properties="$(TestProjectProperties)" />
<MSBuild Projects="@(FunctionalTests)" Targets="restore" Properties="$(TestProjectProperties)" />
<MSBuild Projects="@(UnitTests)" Targets="restore" Properties="$(TestProjectProperties)"/>
</Target>

<Target Name="BuildTools" Condition="'$(BuildTools)' == 'true'">
Expand Down Expand Up @@ -144,13 +149,17 @@
<MSBuild Projects="@(NetCoreDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=Windows_NT;" RemoveProperties="TargetsWindows;TargetsUnix;" Condition="'$(IsEnabledWindows)' == 'true'" />
<MSBuild Projects="@(NetCoreDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=AnyOS;" RemoveProperties="TargetsWindows;TargetsUnix;" />
</Target>

<!-- Build .NET Standard target DLLs for Lib folder from here.
This target enables BuildForLib for the NetCore ref project. -->
<Target Name="BuildNetStandard">
<MSBuild Projects="@(NetStandardDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=AnyOS;BuildForLib=True" RemoveProperties="TargetsWindows;TargetsUnix;" />
</Target>

<Target Name="BuildUnitTestsNetCore" DependsOnTargets="RestoreTestsNetCore" Condition="$(ReferenceType.Contains('Project'))">
<Message Text=">>> Building UnitTestsNetCore [TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=AnyCPU;ReferenceType=$(ReferenceType);] ..." Condition="!$(ReferenceType.Contains('Package'))"/>
<MSBuild Projects="@(UnitTests)" Properties="TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=AnyCPU;" Condition="!$(ReferenceType.Contains('Package'))" />
</Target>

<Target Name="BuildFunctionalTestsNetCore" DependsOnTargets="RestoreTestsNetCore">
<Message Text=">>> Building FunctionalTestsNetCore [TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=AnyCPU;ReferenceType=$(ReferenceType);] ..." Condition="!$(ReferenceType.Contains('Package'))" />
<MSBuild Projects="@(FunctionalTests)" Properties="TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=AnyCPU;" Condition="!$(ReferenceType.Contains('Package'))" />
Expand All @@ -169,6 +178,11 @@
<MSBuild Projects="@(ManualTests)" Properties="TestTargetOS=$(TestOS)netcoreapp;$(TestProjectProperties);Platform=$(Platform);" Condition="$(ReferenceType.Contains('Package'))" />
</Target>

<Target Name="BuildUnitTestsNetFx" DependsOnTargets="RestoreTestsNetFx" Condition="'$(IsEnabledWindows)' == 'true' AND $(ReferenceType.Contains('Project'))">
<Message Text=">>> Building UnitTestsNetFx [TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=AnyCPU;] ..." Condition="!$(ReferenceType.Contains('Package'))"/>
<MSBuild Projects="@(UnitTests)" Properties="TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=AnyCPU;" Condition="!$(ReferenceType.Contains('Package'))"/>
</Target>

<Target Name="BuildFunctionalTestsNetFx" DependsOnTargets="RestoreTestsNetFx" Condition="'$(IsEnabledWindows)' == 'true'">
<Message Text=">>> Building FunctionalTestsNetFx [TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=AnyCPU;] ..." Condition="!$(ReferenceType.Contains('Package'))" />
<MSBuild Projects="@(FunctionalTests)" Properties="TestTargetOS=$(TestOS)netfx;$(TestProjectProperties);Platform=AnyCPU;" Condition="!$(ReferenceType.Contains('Package'))" />
Expand All @@ -189,8 +203,51 @@

<!-- Tests -->

<!-- Run all tests applicable to the host OS. -->
<Target Name="RunTests" DependsOnTargets="RunUnitTests;RunFunctionalTests;RunManualTests"/>

<!-- Run all unit tests applicable to the host OS. -->
<Target Name="RunTests" DependsOnTargets="RunFunctionalTests;RunManualTests" />
<Target Name="RunUnitTests" DependsOnTargets="RunUnitTestsWindows;RunUnitTestsUnix" Condition="$(ReferenceType.Contains('Project'))"/>

<!-- Run all unit tests applicable to Windows. -->
<Target Name="RunUnitTestsWindows" Condition="'$(IsEnabledWindows)' == 'true' AND $(ReferenceType.Contains('Project'))">
<PropertyGroup>
<TestCommand>
$(DotnetPath)dotnet test "@(UnitTestsProj)"
--no-build
-v n
-p:Configuration=$(Configuration)
-p:Target$(TFGroup)Version=$(TF)
-p:TestTargetOS=Windows$(TargetGroup)
--collect "Code coverage"
--results-directory $(ResultsDirectory)
--logger:"trx;LogFilePrefix=Unit-Windows$(TargetGroup)-$(TestSet)"
</TestCommand>
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
</PropertyGroup>
<Message Text=">>> Running unit tests for Windows via command: $(TestCommand)"/>
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)"/>
</Target>

<!-- Run all unit tests applicable to Unix. -->
<Target Name="RunUnitTestsUnix" Condition="'$(IsEnabledWindows)' != 'true' AND $(ReferenceType.Contains('Project'))">
<PropertyGroup>
<TestCommand>
$(DotnetPath)dotnet test "@(UnitTestsProj)"
--no-build
-v n
-p:Configuration=$(Configuration)
-p:TargetNetCoreVersion=$(TF)
-p:TestTargetOS=Unixnetcoreapp
--collect "Code coverage"
--results-directory $(ResultsDirectory)
--logger:"trx;LogFilePrefix=Unit-Unixnetcoreapp-$(TestSet)"
</TestCommand>
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
</PropertyGroup>
<Message Text=">>> Running unit tests for Unix via command: $(TestCommand)"/>
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)"/>
</Target>

<!-- Run all Functional tests applicable to the host OS. -->
<Target Name="RunFunctionalTests" DependsOnTargets="RunFunctionalTestsWindows;RunFunctionalTestsUnix" />
Expand All @@ -215,7 +272,7 @@
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
</PropertyGroup>
<Message Text=">>> Running Functional test for Windows via command: $(TestCommand)" />
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)" />

Check failure on line 275 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (win11_Azure_Sql net9_0_AnyCPU_NativeSNI_2)

build.proj#L275

build.proj(275,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.FunctionalTests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Project -p:TestSet=2 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Functional-Windowsnetcoreapp-2" " exited with code 1.
</Target>

<!-- Run all Functional tests applicable to Unix. -->
Expand Down Expand Up @@ -264,7 +321,7 @@
<TestCommand>$(TestCommand.Replace($([System.Environment]::NewLine), " "))</TestCommand>
</PropertyGroup>
<Message Text=">>> Running Manual test for Windows via command: $(TestCommand)" />
<Exec ConsoleToMsBuild="true" Command="$(TestCommand)" />

Check failure on line 324 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Azure_ARM64_Sql net462_AnyCPU_3)

build.proj#L324

build.proj(324,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetfx-3" " exited with code 1.

Check failure on line 324 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Azure_Sql net8_0_AnyCPU_ManagedSNI_3)

build.proj#L324

build.proj(324,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 324 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Azure_ARM64_Sql net8_0_AnyCPU_NativeSNI_3)

build.proj#L324

build.proj(324,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 324 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Azure_ARM64_Sql net8_0_AnyCPU_NativeSNI_3)

build.proj#L324

build.proj(324,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 324 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient

build.proj#L324

build.proj(324,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:ReferenceType=Project -p:TestSet=3 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetfx-3" " exited with code 1.

Check failure on line 324 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win22_Azure_ARM64_Sql net462_AnyCPU_3)

build.proj#L324

build.proj(324,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetfxVersion=net462 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetfx --collect "Code coverage" --results-directory TestResults --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetfx-3" " exited with code 1.

Check failure on line 324 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win22_Azure_ARM64_Sql net9_0_AnyCPU_ManagedSNI_3)

build.proj#L324

build.proj(324,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 324 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win22_Azure_Sql net8_0_AnyCPU_NativeSNI_3)

build.proj#L324

build.proj(324,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 324 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win22_Azure_Sql net8_0_AnyCPU_ManagedSNI_3)

build.proj#L324

build.proj(324,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 324 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (win11_Azure_Sql net8_0_AnyCPU_ManagedSNI_3)

build.proj#L324

build.proj(324,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.

Check failure on line 324 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package

build.proj#L324

build.proj(324,5): Error MSB3073: The command " dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" --no-build -v n -p:Configuration=Release -p:TargetnetcoreVersion=net9.0 -p:ReferenceType=Package -p:TestSet=3 -p:TestTargetOS=Windowsnetcoreapp --collect "Code coverage" --results-directory TestResults --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" --logger:"trx;LogFilePrefix=Manual-Windowsnetcoreapp-3" " exited with code 1.
</Target>

<!-- Run all Manual tests applicable to Unix. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ steps:
msbuildArchitecture: x64
msbuildArguments: '-t:BuildTestsNetCore -p:ReferenceType=${{parameters.referenceType }} -p:TargetNetCoreVersion=${{parameters.TargetNetCoreVersion }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} -p:Configuration=${{parameters.configuration }}'

# Don't run unit tests using package reference. Unit tests are only run using project reference.

- task: DotNetCoreCLI@2
displayName: 'Run Functional Tests for ${{parameters.TargetNetCoreVersion }}'
inputs:
command: test
projects: 'src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj'
projects: 'src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.FunctionalTests.csproj'
arguments: '-p:Platform=${{parameters.platform }} -p:TestTargetOS="${{parameters.TestTargetOS }}" -p:TargetNetCoreVersion=${{parameters.TargetNetCoreVersion }} -p:ReferenceType=${{parameters.referenceType }} -p:Configuration=${{parameters.configuration }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests"'

- task: DotNetCoreCLI@2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ steps:
inputs:
solution: build.proj
msbuildArguments: ' -t:BuildTestsNetFx -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} -p:TargetNetFxVersion=${{parameters.TargetNetFxVersion }} -p:Configuration=${{parameters.configuration }} -p:Platform=${{parameters.platform }}'

# Don't run unit tests using package reference. Unit tests are only run using project reference.

- task: DotNetCoreCLI@2
displayName: 'Run Functional Tests for ${{parameters.TargetNetFxVersion }}'
inputs:
command: test
projects: 'src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj'
projects: 'src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.FunctionalTests.csproj'
arguments: '-p:Platform=${{parameters.platform }} -p:TestTargetOS="${{parameters.TestTargetOS }}" -p:TargetNetFxVersion=${{parameters.TargetNetFxVersion }} -p:ReferenceType=${{parameters.referenceType }} -p:Configuration=${{parameters.configuration }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests" --collect "Code Coverage"'

- task: DotNetCoreCLI@2
Expand Down
28 changes: 28 additions & 0 deletions eng/pipelines/common/templates/steps/run-all-tests-step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ steps:
condition: succeededOrFailed()

- ${{if eq(parameters.operatingSystem, 'Windows')}}:
- ${{if eq(parameters.referenceType, 'Project')}}:
- task: MSBuild@1
displayName: 'Run Unit Tests ${{parameters.msbuildArchitecture }}'
inputs:
solution: build.proj
msbuildArchitecture: ${{parameters.msbuildArchitecture }}
platform: '${{parameters.platform }}'
configuration: '${{parameters.configuration }}'
${{ if eq(parameters.msbuildArchitecture, 'x64') }}:
msbuildArguments: '-t:RunUnitTests -p:TF=${{parameters.targetFramework }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }}'
${{ else }}: # x86
msbuildArguments: '-t:RunUnitTests -p:TF=${{parameters.targetFramework }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:DotnetPath=${{parameters.dotnetx86RootPath }}'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
retryCountOnTaskFailure: 1

- task: MSBuild@1
displayName: 'Run Functional Tests ${{parameters.msbuildArchitecture }}'
inputs:
Expand Down Expand Up @@ -82,6 +97,19 @@ steps:
retryCountOnTaskFailure: 2

- ${{ else }}: # Linux or macOS
- ${{if eq(parameters.referenceType, 'Project')}}:
- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests'
inputs:
command: custom
projects: build.proj
custom: msbuild
arguments: '-t:RunUnitTests -p:TF=${{parameters.targetFramework }} -p:TestSet=${{parameters.testSet }} -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.nugetPackageVersion }} -p:platform=${{parameters.platform }} -p:Configuration=${{parameters.configuration }}'
verbosityRestore: Detailed
verbosityPack: Detailed
retryCountOnTaskFailure: 1
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))

- task: DotNetCoreCLI@2
displayName: 'Run Functional Tests'
inputs:
Expand Down
Loading
Loading