Skip to content

Commit 269fb3f

Browse files
Copilotbartelink
andcommitted
Migrate tests to xunit V3: replace xunit with xunit.v3, FsCheck.xUnit with FsCheck.Xunit.v3, remove xunit.runner.visualstudio and Microsoft.NET.Test.Sdk, add OutputType Exe, update build.proj/azure-pipelines.yml/README.md
Agent-Logs-Url: https://github.com/jet/equinox/sessions/4db74df8-7a20-4871-9734-7482b050d990 Co-authored-by: bartelink <206668+bartelink@users.noreply.github.com>
1 parent 13c54e5 commit 269fb3f

17 files changed

Lines changed: 70 additions & 112 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,11 @@ A key facility of this repo is being able to run load tests, either in process a
733733
734734
Please note the [QuickStart](#quickstart) is probably the best way to gain an overview - these instructions are intended to illustrated various facilities of the build script for people making changes.
735735
736-
### build and run
736+
### build and run tests locally
737+
738+
Run tests in Debug configuration (default for local builds):
739+
740+
dotnet test build.proj
737741
738742
Run, including running the tests that assume you've got a local EventStore and pointers to a CosmosDB database and container prepared (see [PROVISIONING](#provisioning)):
739743

azure-pipelines.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ jobs:
77
- script: dotnet test build.proj -v n
88
displayName: dotnet test build.proj
99
env:
10+
CI: true
1011
EQUINOX_INTEGRATION_SKIP_EVENTSTORE: true
1112
EQUINOX_INTEGRATION_SKIP_COSMOS: true
1213
- task: PublishTestResults@2
@@ -30,6 +31,7 @@ jobs:
3031
- script: dotnet test build.proj -v n
3132
displayName: dotnet test build.proj
3233
env:
34+
CI: true
3335
EQUINOX_INTEGRATION_SKIP_EVENTSTORE: true
3436
EQUINOX_INTEGRATION_SKIP_COSMOS: true
3537
- task: PublishTestResults@2
@@ -49,6 +51,7 @@ jobs:
4951
- script: dotnet test build.proj -v n
5052
displayName: dotnet test build.proj
5153
env:
54+
CI: true
5255
EQUINOX_INTEGRATION_SKIP_EVENTSTORE: true
5356
EQUINOX_INTEGRATION_SKIP_COSMOS: true
5457
- task: PublishTestResults@2

build.proj

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,40 @@
33
<Import Project="Directory.Build.props" />
44

55
<PropertyGroup>
6-
<Cfg>--configuration Release</Cfg>
6+
<!-- CI sets CI=true; local builds default to Debug without trx logging -->
7+
<Cfg Condition="'$(CI)' == 'true'">--configuration Release</Cfg>
8+
<Cfg Condition="'$(CI)' != 'true'">--configuration Debug</Cfg>
79

810
<PackOptions>/p:BUILD_ID=$(BUILD_ID) -o $(MSBuildThisFileDirectory)bin</PackOptions>
911

10-
<TestOptions>--logger:trx</TestOptions>
12+
<TestOptions Condition="'$(CI)' == 'true'">--logger:trx</TestOptions>
13+
<TestOptions Condition="'$(CI)' != 'true'"></TestOptions>
1114
</PropertyGroup>
1215

1316
<Target Name="Pack">
14-
<Exec Command="dotnet pack src/Equinox $(Cfg) $(PackOptions)" />
15-
<Exec Command="dotnet pack src/Equinox.Core $(Cfg) $(PackOptions)" />
16-
<Exec Command="dotnet pack src/Equinox.CosmosStore $(Cfg) $(PackOptions)" />
17-
<Exec Command="dotnet pack src/Equinox.CosmosStore.Prometheus $(Cfg) $(PackOptions)" />
18-
<Exec Command="dotnet pack src/Equinox.DynamoStore $(Cfg) $(PackOptions)" />
19-
<Exec Command="dotnet pack src/Equinox.DynamoStore.Prometheus $(Cfg) $(PackOptions)" />
20-
<Exec Command="dotnet pack src/Equinox.EventStore $(Cfg) $(PackOptions)" />
21-
<Exec Command="dotnet pack src/Equinox.EventStoreDb $(Cfg) $(PackOptions)" />
22-
<Exec Command="dotnet pack src/Equinox.MessageDb $(Cfg) $(PackOptions)" />
23-
<Exec Command="dotnet pack src/Equinox.MemoryStore $(Cfg) $(PackOptions)" />
24-
<Exec Command="dotnet pack src/Equinox.SqlStreamStore $(Cfg) $(PackOptions)" />
25-
<Exec Command="dotnet pack src/Equinox.SqlStreamStore.MsSql $(Cfg) $(PackOptions)" />
26-
<Exec Command="dotnet pack src/Equinox.SqlStreamStore.MySql $(Cfg) $(PackOptions)" />
27-
<Exec Command="dotnet pack src/Equinox.SqlStreamStore.Postgres $(Cfg) $(PackOptions)" />
28-
<Exec Command="dotnet pack tools/Equinox.Tools.TestHarness $(Cfg) $(PackOptions)" />
29-
<Exec Command="dotnet pack tools/Equinox.Tool $(Cfg) $(PackOptions) /p:PackAsTool=true" />
17+
<Exec Command="dotnet pack src/Equinox --configuration Release $(PackOptions)" />
18+
<Exec Command="dotnet pack src/Equinox.Core --configuration Release $(PackOptions)" />
19+
<Exec Command="dotnet pack src/Equinox.CosmosStore --configuration Release $(PackOptions)" />
20+
<Exec Command="dotnet pack src/Equinox.CosmosStore.Prometheus --configuration Release $(PackOptions)" />
21+
<Exec Command="dotnet pack src/Equinox.DynamoStore --configuration Release $(PackOptions)" />
22+
<Exec Command="dotnet pack src/Equinox.DynamoStore.Prometheus --configuration Release $(PackOptions)" />
23+
<Exec Command="dotnet pack src/Equinox.EventStore --configuration Release $(PackOptions)" />
24+
<Exec Command="dotnet pack src/Equinox.EventStoreDb --configuration Release $(PackOptions)" />
25+
<Exec Command="dotnet pack src/Equinox.MessageDb --configuration Release $(PackOptions)" />
26+
<Exec Command="dotnet pack src/Equinox.MemoryStore --configuration Release $(PackOptions)" />
27+
<Exec Command="dotnet pack src/Equinox.SqlStreamStore --configuration Release $(PackOptions)" />
28+
<Exec Command="dotnet pack src/Equinox.SqlStreamStore.MsSql --configuration Release $(PackOptions)" />
29+
<Exec Command="dotnet pack src/Equinox.SqlStreamStore.MySql --configuration Release $(PackOptions)" />
30+
<Exec Command="dotnet pack src/Equinox.SqlStreamStore.Postgres --configuration Release $(PackOptions)" />
31+
<Exec Command="dotnet pack tools/Equinox.Tools.TestHarness --configuration Release $(PackOptions)" />
32+
<Exec Command="dotnet pack tools/Equinox.Tool --configuration Release $(PackOptions) /p:PackAsTool=true" />
3033
</Target>
3134

32-
<Target Name="VSTest">
35+
<Target Name="Test">
3336
<Exec Command="dotnet test Equinox.sln $(Cfg) $(TestOptions)" />
3437
</Target>
3538

36-
<Target Name="Build" DependsOnTargets="VSTest;Pack">
39+
<Target Name="Build" DependsOnTargets="Test;Pack">
3740
<Exec Command="dotnet build samples/Tutorial $(Cfg)" />
3841
</Target>
3942

samples/Store/Domain.Tests/Domain.Tests.fsproj

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net10.0</TargetFramework>
5+
<OutputType>Exe</OutputType>
56
</PropertyGroup>
67

78
<ItemGroup>
@@ -18,13 +19,8 @@
1819
</ItemGroup>
1920

2021
<ItemGroup>
21-
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-rc3" />
22-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
23-
<PackageReference Include="xunit" Version="2.7.0" />
24-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
25-
<PrivateAssets>all</PrivateAssets>
26-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
27-
</PackageReference>
22+
<PackageReference Include="FsCheck.Xunit.v3" Version="3.3.2" />
23+
<PackageReference Include="xunit.v3" Version="3.2.2" />
2824
<PackageReference Include="unquote" Version="6.1.0" />
2925
</ItemGroup>
3026

samples/Store/Integration/Integration.fsproj

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net10.0</TargetFramework>
5+
<OutputType>Exe</OutputType>
56
</PropertyGroup>
67

78
<ItemGroup>
@@ -25,15 +26,10 @@
2526
</ItemGroup>
2627

2728
<ItemGroup>
28-
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-rc3" />
29-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
29+
<PackageReference Include="FsCheck.Xunit.v3" Version="3.3.2" />
3030
<PackageReference Include="Serilog.Sinks.Seq" Version="7.0.0" />
3131
<PackageReference Include="unquote" Version="6.1.0" />
32-
<PackageReference Include="xunit" Version="2.7.0" />
33-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
34-
<PrivateAssets>all</PrivateAssets>
35-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
36-
</PackageReference>
32+
<PackageReference Include="xunit.v3" Version="3.2.2" />
3733
</ItemGroup>
3834

3935
</Project>

samples/Store/Integration/TestOutput.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type LogCaptureBuffer() =
2222
member _.Clear () = captured.Clear()
2323
member _.ChooseCalls chooser = captured |> Seq.choose chooser |> List.ofSeq
2424

25-
type TestOutput(testOutput: Xunit.Abstractions.ITestOutputHelper) =
25+
type TestOutput(testOutput: Xunit.ITestOutputHelper) =
2626

2727
let write (m: string) =
2828
m.TrimEnd '\n' |> testOutput.WriteLine

src/Equinox.Tests/Equinox.Tests.fsproj

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
5+
<OutputType>Exe</OutputType>
56
</PropertyGroup>
67

78
<ItemGroup>
@@ -14,12 +15,7 @@
1415
</ItemGroup>
1516

1617
<ItemGroup>
17-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
1818
<PackageReference Include="unquote" Version="6.1.0" />
19-
<PackageReference Include="xunit" Version="2.7.0" />
20-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
21-
<PrivateAssets>all</PrivateAssets>
22-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
23-
</PackageReference>
19+
<PackageReference Include="xunit.v3" Version="3.2.2" />
2420
</ItemGroup>
2521
</Project>

tests/Equinox.Core.Tests/Equinox.Core.Tests.fsproj

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net10.0</TargetFramework>
5+
<OutputType>Exe</OutputType>
56
</PropertyGroup>
67

78
<ItemGroup>
@@ -16,14 +17,9 @@
1617
</ItemGroup>
1718

1819
<ItemGroup>
19-
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-rc3" />
20-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
20+
<PackageReference Include="FsCheck.Xunit.v3" Version="3.3.2" />
2121
<PackageReference Include="unquote" Version="6.1.0" />
22-
<PackageReference Include="xunit" Version="2.7.0" />
23-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
24-
<PrivateAssets>all</PrivateAssets>
25-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
26-
</PackageReference>
22+
<PackageReference Include="xunit.v3" Version="3.2.2" />
2723
</ItemGroup>
2824

2925
</Project>

tests/Equinox.CosmosStore.Integration/Equinox.CosmosStore.Integration.fsproj

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net10.0</TargetFramework>
5+
<OutputType>Exe</OutputType>
56
</PropertyGroup>
67

78
<ItemGroup>
@@ -22,15 +23,10 @@
2223
</ItemGroup>
2324

2425
<ItemGroup>
25-
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-rc3" />
26+
<PackageReference Include="FsCheck.Xunit.v3" Version="3.3.2" />
2627
<PackageReference Include="JsonDiffPatch.Net" Version="2.3.0" />
27-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
2828
<PackageReference Include="Serilog.Sinks.Seq" Version="7.0.0" />
2929
<PackageReference Include="unquote" Version="6.1.0" />
30-
<PackageReference Include="xunit" Version="2.7.0" />
31-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
32-
<PrivateAssets>all</PrivateAssets>
33-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
34-
</PackageReference>
30+
<PackageReference Include="xunit.v3" Version="3.2.2" />
3531
</ItemGroup>
3632
</Project>

tests/Equinox.DynamoStore.Integration/Equinox.DynamoStore.Integration.fsproj

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net10.0</TargetFramework>
5+
<OutputType>Exe</OutputType>
56
<DefineConstants>$(DefineConstants);STORE_DYNAMO</DefineConstants>
67
</PropertyGroup>
78

@@ -30,14 +31,9 @@
3031
</ItemGroup>
3132

3233
<ItemGroup>
33-
<PackageReference Include="FsCheck.xUnit" Version="3.0.0-rc3" />
34-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
34+
<PackageReference Include="FsCheck.Xunit.v3" Version="3.3.2" />
3535
<PackageReference Include="Serilog.Sinks.Seq" Version="7.0.0" />
3636
<PackageReference Include="unquote" Version="6.1.0" />
37-
<PackageReference Include="xunit" Version="2.7.0" />
38-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
39-
<PrivateAssets>all</PrivateAssets>
40-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
41-
</PackageReference>
37+
<PackageReference Include="xunit.v3" Version="3.2.2" />
4238
</ItemGroup>
4339
</Project>

0 commit comments

Comments
 (0)