Skip to content

Commit b43a566

Browse files
gunndabadclaude
andauthored
Drop the VSTest packages and finish the xunit.v3 4.0.0 upgrade (#562)
* Drop xunit.runner.visualstudio The test runner is Microsoft.Testing.Platform now, and xunit.v3 4.0.0 has dropped VSTest support altogether, so the adapter no longer does anything. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * Drop Microsoft.NET.Test.Sdk and move every test project to xunit.v3 4.0.0 The VSTest host has no part to play now that Microsoft.Testing.Platform runs the tests, and dropping it means the package tests have to ask for OutputType Exe themselves; the web SDK projects already default to it. xunit.v3 4.0.0 threads parallel mode, the scheduler and the fixture mappings through ISelfExecutingXunitTestCase.Run and the runner contexts, so the custom tag helper test case passes them along. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent 24c4ce3 commit b43a566

5 files changed

Lines changed: 41 additions & 28 deletions

File tree

tests/GovUk.FrontEnd.AspNetCore.TestCommon/GovUk.FrontEnd.AspNetCore.TestCommon.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
<ItemGroup>
1414
<PackageReference Include="AngleSharp" Version="1.5.2" />
1515
<PackageReference Include="AngleSharp.Diffing" Version="1.1.1" />
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
17-
<PackageReference Include="xunit.v3.assert" Version="3.1.0" />
16+
<PackageReference Include="xunit.v3.assert" Version="4.0.0" />
1817
</ItemGroup>
1918

2019
<ItemGroup>

tests/GovUk.Frontend.AspNetCore.IntegrationTests/GovUk.Frontend.AspNetCore.IntegrationTests.csproj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,8 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
1413
<PackageReference Include="Microsoft.Playwright" Version="1.21.0" />
15-
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
16-
<PrivateAssets>all</PrivateAssets>
17-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18-
</PackageReference>
19-
<PackageReference Include="xunit.v3" Version="3.1.0" />
14+
<PackageReference Include="xunit.v3" Version="4.0.0" />
2015
</ItemGroup>
2116

2217
<ItemGroup>

tests/GovUk.Frontend.AspNetCore.PackageTests/GovUk.Frontend.AspNetCore.PackageTests.csproj

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<!-- These tests drive the SDK as a child process, so the host only needs one TFM; the frameworks
55
under test are a property of the generated fixture projects. -->
66
<TargetFramework>net10.0</TargetFramework>
7+
<!-- xunit.v3 hosts the tests itself; the web SDK projects get this from their own defaults -->
8+
<OutputType>Exe</OutputType>
79

810
<IsPackable>false</IsPackable>
911
<ImplicitUsings>enable</ImplicitUsings>
@@ -15,11 +17,6 @@
1517

1618
<ItemGroup>
1719
<PackageReference Include="AngleSharp" Version="1.7.1" />
18-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.8.1" />
19-
<PackageReference Include="xunit.runner.visualstudio" Version="4.0.0">
20-
<PrivateAssets>all</PrivateAssets>
21-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
22-
</PackageReference>
2320
<PackageReference Include="xunit.v3" Version="4.0.0" />
2421
</ItemGroup>
2522

tests/GovUk.Frontend.AspNetCore.Tests/GovUk.Frontend.AspNetCore.Tests.csproj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
1312
<PackageReference Include="Moq" Version="4.20.72" />
14-
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
15-
<PrivateAssets>all</PrivateAssets>
16-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
17-
</PackageReference>
18-
<PackageReference Include="xunit.v3" Version="3.1.0" />
13+
<PackageReference Include="xunit.v3" Version="4.0.0" />
1914
</ItemGroup>
2015

2116
<ItemGroup>

tests/GovUk.Frontend.AspNetCore.Tests/TagHelpers/TagHelperTestCase.cs

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ public ValueTask<RunSummary> Run(
109109
IMessageBus messageBus,
110110
object?[] constructorArguments,
111111
ExceptionAggregator aggregator,
112-
CancellationTokenSource cancellationTokenSource) =>
112+
CancellationTokenSource cancellationTokenSource,
113+
ParallelMode parallelMode,
114+
ExecutionScheduler scheduler,
115+
FixtureMappingManager methodFixtureMappings) =>
113116
TagHelperTestCaseRunner.Instance.Run(
114117
TagHelperTestCaseInfo!,
115118
this,
@@ -119,7 +122,10 @@ public ValueTask<RunSummary> Run(
119122
TestCaseDisplayName,
120123
SkipReason,
121124
explicitOption,
122-
constructorArguments);
125+
constructorArguments,
126+
parallelMode,
127+
scheduler,
128+
methodFixtureMappings);
123129

124130
protected override void Deserialize(IXunitSerializationInfo info)
125131
{
@@ -163,7 +169,10 @@ public class TagHelperTestCaseRunnerContext(
163169
string displayName,
164170
string? skipReason,
165171
ExplicitOption explicitOption,
166-
object?[] constructorArguments) : XunitTestCaseRunnerBaseContext<IXunitTestCase, IXunitTest>(testCase, tests, messageBus, aggregator, cancellationTokenSource, displayName, skipReason, explicitOption, constructorArguments)
172+
object?[] constructorArguments,
173+
ParallelMode parallelMode,
174+
ExecutionScheduler scheduler,
175+
FixtureMappingManager methodFixtureMappings) : XunitTestCaseRunnerBaseContext<IXunitTestCase, IXunitTest>(testCase, tests, explicitOption, messageBus, aggregator, displayName, skipReason, cancellationTokenSource, parallelMode, scheduler, constructorArguments, methodFixtureMappings)
167176
{
168177
public TagHelperTestCaseInfo TagHelperTestCaseInfo => tagHelperTestCaseInfo;
169178
}
@@ -181,7 +190,10 @@ public async ValueTask<RunSummary> Run(
181190
string displayName,
182191
string? skipReason,
183192
ExplicitOption explicitOption,
184-
object?[] constructorArguments)
193+
object?[] constructorArguments,
194+
ParallelMode parallelMode,
195+
ExecutionScheduler scheduler,
196+
FixtureMappingManager methodFixtureMappings)
185197
{
186198
// See XunitRunnerHelper.RunXunitTestCase
187199

@@ -231,7 +243,10 @@ public async ValueTask<RunSummary> Run(
231243
displayName,
232244
skipReason,
233245
explicitOption,
234-
constructorArguments);
246+
constructorArguments,
247+
parallelMode,
248+
scheduler,
249+
methodFixtureMappings);
235250

236251
await ctxt.InitializeAsync();
237252

@@ -248,7 +263,10 @@ protected override ValueTask<RunSummary> RunTest(TagHelperTestCaseRunnerContext
248263
ctxt.ExplicitOption,
249264
ctxt.Aggregator.Clone(),
250265
ctxt.CancellationTokenSource,
251-
ctxt.BeforeAfterTestAttributes);
266+
ctxt.BeforeAfterTestAttributes,
267+
ctxt.ParallelMode,
268+
ctxt.Scheduler,
269+
ctxt.CaseFixtureMappings);
252270
}
253271
}
254272

@@ -260,7 +278,10 @@ public class TagHelperTestRunnerContext(
260278
ExceptionAggregator aggregator,
261279
CancellationTokenSource cancellationTokenSource,
262280
IReadOnlyCollection<IBeforeAfterTestAttribute> beforeAfterAttributes,
263-
object?[] constructorArguments) : XunitTestRunnerContext(test, messageBus, explicitOption, aggregator, cancellationTokenSource, beforeAfterAttributes, constructorArguments)
281+
object?[] constructorArguments,
282+
ParallelMode parallelMode,
283+
ExecutionScheduler scheduler,
284+
FixtureMappingManager caseFixtureMappings) : XunitTestRunnerContext(test, explicitOption, messageBus, aggregator, cancellationTokenSource, parallelMode, scheduler, beforeAfterAttributes, constructorArguments, caseFixtureMappings)
264285
{
265286
public TagHelperTestCaseInfo TagHelperTestCaseInfo => tagHelperTestCaseInfo;
266287
}
@@ -277,7 +298,10 @@ public async ValueTask<RunSummary> Run(
277298
ExplicitOption explicitOption,
278299
ExceptionAggregator aggregator,
279300
CancellationTokenSource cancellationTokenSource,
280-
IReadOnlyCollection<IBeforeAfterTestAttribute> beforeAfterAttributes)
301+
IReadOnlyCollection<IBeforeAfterTestAttribute> beforeAfterAttributes,
302+
ParallelMode parallelMode,
303+
ExecutionScheduler scheduler,
304+
FixtureMappingManager caseFixtureMappings)
281305
{
282306
await using var ctxt = new TagHelperTestRunnerContext(
283307
tagHelperTestCaseInfo,
@@ -287,7 +311,10 @@ public async ValueTask<RunSummary> Run(
287311
aggregator,
288312
cancellationTokenSource,
289313
beforeAfterAttributes,
290-
constructorArguments
314+
constructorArguments,
315+
parallelMode,
316+
scheduler,
317+
caseFixtureMappings
291318
);
292319
await ctxt.InitializeAsync();
293320

0 commit comments

Comments
 (0)