Skip to content

Commit 6790b48

Browse files
committed
Add aggressive display to TestFrameworkEnvironment reported by XunitTestAssemblyRunner
1 parent 3dd7e91 commit 6790b48

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/xunit.execution/Sdk/Frameworks/Runners/XunitTestAssemblyRunner.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,20 @@ protected override string GetTestFrameworkEnvironment()
5959

6060
var testCollectionFactory = ExtensibilityPointFactory.GetXunitTestCollectionFactory(DiagnosticMessageSink, collectionBehaviorAttribute, TestAssembly);
6161
var threadCountText = maxParallelThreads < 0 ? "unlimited" : maxParallelThreads.ToString(CultureInfo.CurrentCulture);
62+
threadCountText += " thread";
63+
if (maxParallelThreads != 1)
64+
threadCountText += 's';
65+
if (parallelAlgorithm == ParallelAlgorithm.Aggressive)
66+
threadCountText += "/aggressive";
6267

6368
return string.Format(
6469
CultureInfo.CurrentCulture,
6570
"{0} [{1}, {2}]",
6671
base.GetTestFrameworkEnvironment(),
6772
testCollectionFactory.DisplayName,
68-
disableParallelization ? "non-parallel" : string.Format(CultureInfo.CurrentCulture, "parallel ({0} threads)", threadCountText)
73+
disableParallelization
74+
? "non-parallel"
75+
: string.Format(CultureInfo.CurrentCulture, "parallel ({0})", threadCountText)
6976
);
7077
}
7178

test/test.xunit.execution/Sdk/Frameworks/Runners/XunitTestAssemblyRunnerTests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,19 @@ public static void TestOptions_MaxThreads()
136136
Assert.EndsWith("[collection-per-class, parallel (3 threads)]", result);
137137
}
138138

139+
[Fact]
140+
public static void TestOptions_MaxThreads_Aggressive()
141+
{
142+
var options = TestFrameworkOptions.ForExecution();
143+
options.SetMaxParallelThreads(3);
144+
options.SetParallelAlgorithm(ParallelAlgorithm.Aggressive);
145+
var runner = TestableXunitTestAssemblyRunner.Create(executionOptions: options);
146+
147+
var result = runner.GetTestFrameworkEnvironment();
148+
149+
Assert.EndsWith("[collection-per-class, parallel (3 threads/aggressive)]", result);
150+
}
151+
139152
[Fact]
140153
public static void TestOptions_Unlimited()
141154
{

0 commit comments

Comments
 (0)