Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions TUnit.Engine/Scheduling/TestScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,9 @@ private async Task ExecuteGroupedTestsAsync(
// 1. NotInParallel tests (global) - must run one at a time
if (groupedTests.NotInParallel.Length > 0)
{
var globalNotInParallelTask = ExecuteNotInParallelTestsAsync(
await ExecuteNotInParallelTestsAsync(
groupedTests.NotInParallel,
cancellationToken);
allTestTasks.Add(globalNotInParallelTask);
}

// 2. Keyed NotInParallel tests
Expand Down Expand Up @@ -319,7 +318,7 @@ private async Task ExecuteParallelGroupAsync(
// Use worker pool pattern for parallel groups
var testQueue = new System.Collections.Concurrent.ConcurrentQueue<AbstractExecutableTest>(tests);
var workers = new Task[maxParallelism.Value];

for (int i = 0; i < maxParallelism.Value; i++)
{
workers[i] = Task.Run(async () =>
Expand All @@ -328,12 +327,12 @@ private async Task ExecuteParallelGroupAsync(
{
if (cancellationToken.IsCancellationRequested)
break;

await test.ExecutionTask.ConfigureAwait(false);
}
}, cancellationToken);
}

await Task.WhenAll(workers).ConfigureAwait(false);
}
else
Expand All @@ -355,7 +354,7 @@ private async Task ExecuteParallelTestsAsync(
// Create a fixed number of worker tasks that process tests from a queue
var testQueue = new System.Collections.Concurrent.ConcurrentQueue<AbstractExecutableTest>(tests);
var workers = new Task[maxParallelism.Value];

// Create worker tasks
for (int i = 0; i < maxParallelism.Value; i++)
{
Expand All @@ -365,12 +364,12 @@ private async Task ExecuteParallelTestsAsync(
{
if (cancellationToken.IsCancellationRequested)
break;

await test.ExecutionTask.ConfigureAwait(false);
}
}, cancellationToken);
}

await Task.WhenAll(workers).ConfigureAwait(false);
}
else
Expand Down
Loading