Skip to content

Commit

Permalink
Eradicate Nunit (#17782)
Browse files Browse the repository at this point in the history
  • Loading branch information
psfinaki authored Sep 26, 2024
1 parent 2812497 commit 67793bf
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 27 deletions.
8 changes: 1 addition & 7 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(NETCoreSdkPortableRuntimeIdentifier)/fsyacc.dll</FsYaccPath>
</PropertyGroup>

<ItemGroup Condition="'$(UnitTestType)' == 'nunit'">
<PackageReference Include="NUnit" Version="$(NUnitVersion)" />
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnit3TestAdapterVersion)" />
<PackageReference Include="NunitXml.TestLogger" Version="$(NunitXmlTestLoggerVersion)" />
</ItemGroup>

<ItemGroup Condition="'$(UnitTestType)' == 'xunit'">
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVersion)" />
<PackageReference Include="NunitXml.TestLogger" Version="$(NunitXmlTestLoggerVersion)" />
<PackageReference Include="XunitXml.TestLogger" Version="$(XunitXmlTestLoggerVersion)" />
</ItemGroup>

<!--
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines-PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ stages:
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFormat: 'NUnit'
testResultsFormat: 'XUnit'
testResultsFiles: '*.xml'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_configuration)'
continueOnError: true
Expand Down Expand Up @@ -557,7 +557,7 @@ stages:
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFormat: 'NUnit'
testResultsFormat: 'XUnit'
testResultsFiles: '*.xml'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
continueOnError: true
Expand Down Expand Up @@ -600,7 +600,7 @@ stages:
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFormat: 'NUnit'
testResultsFormat: 'XUnit'
testResultsFiles: '*.xml'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
continueOnError: true
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ extends:
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFormat: 'NUnit'
testResultsFormat: 'XUnit'
testResultsFiles: '*.xml'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
continueOnError: true
Expand Down
4 changes: 2 additions & 2 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str
$projectName = [System.IO.Path]::GetFileNameWithoutExtension($testProject)
$testLogPath = "$ArtifactsDir\TestResults\$configuration\${projectName}_$targetFramework.xml"
$testBinLogPath = "$LogDir\${projectName}_$targetFramework.binlog"
$args = "test $testProject -c $configuration -f $targetFramework -v n --test-adapter-path $testadapterpath --logger ""nunit;LogFilePath=$testLogPath"" /bl:$testBinLogPath"
$args = "test $testProject -c $configuration -f $targetFramework -v n --test-adapter-path $testadapterpath --logger ""xunit;LogFilePath=$testLogPath"" /bl:$testBinLogPath"
$args += " --blame --results-directory $ArtifactsDir\TestResults\$configuration -p:vstestusemsbuildoutput=false"

if (-not $noVisualStudio -or $norestore) {
Expand All @@ -383,7 +383,7 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str
Write-Host("Starting on the background: $args")
Write-Host("------------------------------------")
$bgJob = Start-Job -ScriptBlock {
& $using:dotnetExe test $using:testProject -c $using:configuration -f $using:targetFramework -v n --test-adapter-path $using:testadapterpath --logger "nunit;LogFilePath=$using:testLogPath" /bl:$using:testBinLogPath --blame --results-directory $using:ArtifactsDir\TestResults\$using:configuration
& $using:dotnetExe test $using:testProject -c $using:configuration -f $using:targetFramework -v n --test-adapter-path $using:testadapterpath --logger "xunit;LogFilePath=$using:testLogPath" /bl:$using:testBinLogPath --blame --results-directory $using:ArtifactsDir\TestResults\$using:configuration
if ($LASTEXITCODE -ne 0) {
throw "Command failed to execute with exit code $($LASTEXITCODE): $using:dotnetExe $using:args"
}
Expand Down
5 changes: 1 addition & 4 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,12 @@
<MicrosoftNETCoreILAsmVersion>5.0.0-preview.7.20364.11</MicrosoftNETCoreILAsmVersion>
<MicrosoftNETTestSdkVersion>17.4.0</MicrosoftNETTestSdkVersion>
<NewtonsoftJsonVersion>13.0.3</NewtonsoftJsonVersion>
<NUnitVersion>3.13.2</NUnitVersion>
<NUnit3TestAdapterVersion>4.1.0</NUnit3TestAdapterVersion>
<NUnitLiteVersion>3.11.0</NUnitLiteVersion>
<NunitXmlTestLoggerVersion>2.1.80</NunitXmlTestLoggerVersion>
<RoslynToolsSignToolVersion>1.0.0-beta2-dev3</RoslynToolsSignToolVersion>
<StreamJsonRpcVersion>2.18.48</StreamJsonRpcVersion>
<NerdbankStreamsVersion>2.10.69</NerdbankStreamsVersion>
<XUnitVersion>2.9.0</XUnitVersion>
<XUnitRunnerVersion>2.8.2</XUnitRunnerVersion>
<XunitXmlTestLoggerVersion>3.1.17</XunitXmlTestLoggerVersion>
<FluentAssertionsVersion>5.10.3</FluentAssertionsVersion>
<HumanizerCoreVersion>2.2.0</HumanizerCoreVersion>
<!-- -->
Expand Down
2 changes: 1 addition & 1 deletion eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ function Test() {
projectname=$(basename -- "$testproject")
projectname="${projectname%.*}"
testlogpath="$artifacts_dir/TestResults/$configuration/${projectname}_$targetframework.xml"
args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"nunit;LogFilePath=$testlogpath\" --blame --results-directory $artifacts_dir/TestResults/$configuration -p:vstestusemsbuildoutput=false"
args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"xunit;LogFilePath=$testlogpath\" --blame --results-directory $artifacts_dir/TestResults/$configuration -p:vstestusemsbuildoutput=false"
"$DOTNET_INSTALL_DIR/dotnet" $args || exit $?
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<IsPackable>false</IsPackable>
<DefineConstants>NO_GENERATIVE</DefineConstants>
<FSharpCoreImplicitPackageVersion>$(FSharpCoreShippedPackageVersionValue)</FSharpCoreImplicitPackageVersion>
<UnitTestType>xunit</UnitTestType>
</PropertyGroup>

<ItemGroup>
Expand All @@ -21,8 +22,6 @@
</Content>
<PackageReference Include="BasicProvider" Version="1.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2" />
</ItemGroup>

<Target Name="RemovePackagesFromCache" BeforeTargets="Restore">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<IsPackable>false</IsPackable>
<FSharpCoreImplicitPackageVersion>$(FSharpCoreShippedPackageVersionValue)</FSharpCoreImplicitPackageVersion>
<DefineConstants>NO_GENERATIVE</DefineConstants>
<UnitTestType>xunit</UnitTestType>
</PropertyGroup>

<ItemGroup>
Expand All @@ -18,8 +19,6 @@

<PackageReference Include="ComboProvider" Version="1.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2" />
</ItemGroup>

<Target Name="RemovePackagesFromCache" BeforeTargets="Restore">
Expand Down
5 changes: 0 additions & 5 deletions tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
<TailCalls>true</TailCalls>
</PropertyGroup>

<PropertyGroup>
<DefineConstants Condition="'$(UnitTestType)' == 'xunit'">$(DefineConstants);XUNIT</DefineConstants>
<DefineConstants Condition="'$(UnitTestType)' != 'xunit'">$(DefineConstants);NUNIT</DefineConstants>
</PropertyGroup>

<ItemGroup>
<Compile Include="TestFrameworkHelpers.fs" />
<Compile Include="LibraryTestFx.fs" />
Expand Down

0 comments on commit 67793bf

Please sign in to comment.