Skip to content

Commit

Permalink
Split xRetry.SpecFlow unit tests
Browse files Browse the repository at this point in the history
Moving them into their own project so that a separate project can be added for Reqnroll. Tests using both of these  won't be able to co-exist in the same project.
  • Loading branch information
JoshKeegan committed May 23, 2024
1 parent 0c039b6 commit a39a34c
Show file tree
Hide file tree
Showing 21 changed files with 57 additions and 8 deletions.
6 changes: 6 additions & 0 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ build: clean

cd ../test/UnitTests.SingleThreaded && \
dotnet build -c Release --no-restore -p:Version=$(VERSION)

cd ../test/UnitTests.SpecFlow && \
dotnet build -c Release --no-restore -p:Version=$(VERSION)

.PHONY: unit-tests-run
unit-tests-run:
Expand All @@ -36,6 +39,9 @@ unit-tests-run:
# You can tell if this times out as it returns exit code 124, which make prints as "Error 124"
cd ../test/UnitTests.SingleThreaded && \
timeout 10 dotnet test --no-build -c Release --logger:trx\;logfilename=../../../artefacts/testResults/UnitTests.SingleThreaded.trx

cd ../test/UnitTests.SpecFlow && \
dotnet test --no-build -c Release --logger:trx\;logfilename=../../../artefacts/testResults/UnitTests.SpecFlow.trx

.PHONY: docs
docs:
Expand Down
40 changes: 40 additions & 0 deletions test/UnitTests.SpecFlow/UnitTests.SpecFlow.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net48</TargetFrameworks>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<SpecFlowGeneratorPlugins Condition="'$(MSBuildRuntimeType)' == 'Core'" Include="../../src/xRetry.SpecFlow/bin/Release/netstandard2.0/xRetry.SpecFlowPlugin.dll" />
<SpecFlowGeneratorPlugins Condition="'$(MSBuildRuntimeType)' != 'Core'" Include="../../src/xRetry.SpecFlow/bin/Release/net461/xRetry.SpecFlowPlugin.dll" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoFixture" Version="4.18.1" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.9.74" />
<PackageReference Include="SpecFlow.xUnit" Version="3.9.74" />
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

<!-- required for .net framework xunit tests to run on mono via dotnet test: https://github.com/microsoft/vstest/issues/2469 -->
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="17.10.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\xRetry.SpecFlow\xRetry.SpecFlow.csproj" />
<ProjectReference Include="..\..\src\xRetry\xRetry.csproj" />
</ItemGroup>

</Project>
4 changes: 4 additions & 0 deletions test/UnitTests.SpecFlow/xunit.runner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json",
"diagnosticMessages": true
}
8 changes: 0 additions & 8 deletions test/UnitTests/UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,10 @@
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<SpecFlowGeneratorPlugins Condition="'$(MSBuildRuntimeType)' == 'Core'" Include="../../src/xRetry.SpecFlow/bin/Release/netstandard2.0/xRetry.SpecFlowPlugin.dll" />
<SpecFlowGeneratorPlugins Condition="'$(MSBuildRuntimeType)' != 'Core'" Include="../../src/xRetry.SpecFlow/bin/Release/net461/xRetry.SpecFlowPlugin.dll" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoFixture" Version="4.18.1" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.9.74" />
<PackageReference Include="SpecFlow.xUnit" Version="3.9.74" />
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
<PrivateAssets>all</PrivateAssets>
Expand All @@ -38,7 +31,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\xRetry.SpecFlow\xRetry.SpecFlow.csproj" />
<ProjectReference Include="..\..\src\xRetry\xRetry.csproj" />
</ItemGroup>

Expand Down
7 changes: 7 additions & 0 deletions xRetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests.SingleThreaded",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xRetry.Reqnroll", "src\xRetry.Reqnroll\xRetry.Reqnroll.csproj", "{A032E765-A483-48D4-83EA-F180E7344E7A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests.SpecFlow", "test\UnitTests.SpecFlow\UnitTests.SpecFlow.csproj", "{69EF0FF4-EF9D-46E2-A2CD-996525D8BD83}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -43,6 +45,10 @@ Global
{A032E765-A483-48D4-83EA-F180E7344E7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A032E765-A483-48D4-83EA-F180E7344E7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A032E765-A483-48D4-83EA-F180E7344E7A}.Release|Any CPU.Build.0 = Release|Any CPU
{69EF0FF4-EF9D-46E2-A2CD-996525D8BD83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69EF0FF4-EF9D-46E2-A2CD-996525D8BD83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69EF0FF4-EF9D-46E2-A2CD-996525D8BD83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{69EF0FF4-EF9D-46E2-A2CD-996525D8BD83}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -53,6 +59,7 @@ Global
{386D6FB2-876B-4AD0-8282-28ED26F29C4F} = {3A384C09-1858-4BA9-9314-BC18A6234AE9}
{2C225DC1-5349-4E08-86E4-1067DFD52378} = {3A384C09-1858-4BA9-9314-BC18A6234AE9}
{A032E765-A483-48D4-83EA-F180E7344E7A} = {9E9E02E6-169B-455D-9FA5-2553750E336D}
{69EF0FF4-EF9D-46E2-A2CD-996525D8BD83} = {3A384C09-1858-4BA9-9314-BC18A6234AE9}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {87687087-DCC7-4F67-B0B2-D8A4F8D93693}
Expand Down

0 comments on commit a39a34c

Please sign in to comment.