Skip to content

Commit 9d08748

Browse files
committed
Remove dead code in TerminalTestReporter
1 parent 1a9f29b commit 9d08748

File tree

3 files changed

+27
-43
lines changed

3 files changed

+27
-43
lines changed

src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalTestReporter.cs

+18-23
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public void TestExecutionStarted(DateTimeOffset testStartTime, int workerCount,
152152
_terminalWithProgress.StartShowingProgress(workerCount);
153153
}
154154

155-
public void AssemblyRunStarted(string assembly, string? targetFramework, string? architecture, string? executionId)
155+
public void AssemblyRunStarted(string assembly, string? targetFramework, string? architecture)
156156
{
157157
if (_options.ShowAssembly && _options.ShowAssemblyStartAndComplete)
158158
{
@@ -165,12 +165,12 @@ public void AssemblyRunStarted(string assembly, string? targetFramework, string?
165165
});
166166
}
167167

168-
GetOrAddAssemblyRun(assembly, targetFramework, architecture, executionId);
168+
GetOrAddAssemblyRun(assembly, targetFramework, architecture);
169169
}
170170

171-
private TestProgressState GetOrAddAssemblyRun(string assembly, string? targetFramework, string? architecture, string? executionId)
171+
private TestProgressState GetOrAddAssemblyRun(string assembly, string? targetFramework, string? architecture)
172172
{
173-
string key = $"{assembly}|{targetFramework}|{architecture}|{executionId}";
173+
string key = $"{assembly}|{targetFramework}|{architecture}";
174174
return _assemblies.GetOrAdd(key, _ =>
175175
{
176176
IStopwatch sw = CreateStopwatch();
@@ -380,7 +380,6 @@ internal void TestCompleted(
380380
string assembly,
381381
string? targetFramework,
382382
string? architecture,
383-
string? executionId,
384383
string testNodeUid,
385384
string displayName,
386385
TestOutcome outcome,
@@ -398,7 +397,6 @@ internal void TestCompleted(
398397
assembly,
399398
targetFramework,
400399
architecture,
401-
executionId,
402400
testNodeUid,
403401
displayName,
404402
outcome,
@@ -415,7 +413,6 @@ private void TestCompleted(
415413
string assembly,
416414
string? targetFramework,
417415
string? architecture,
418-
string? executionId,
419416
string testNodeUid,
420417
string displayName,
421418
TestOutcome outcome,
@@ -427,7 +424,7 @@ private void TestCompleted(
427424
string? standardOutput,
428425
string? errorOutput)
429426
{
430-
TestProgressState asm = _assemblies[$"{assembly}|{targetFramework}|{architecture}|{executionId}"];
427+
TestProgressState asm = _assemblies[$"{assembly}|{targetFramework}|{architecture}"];
431428

432429
if (_options.ShowActiveTests)
433430
{
@@ -737,12 +734,12 @@ private static void AppendIndentedLine(ITerminal terminal, string? message, stri
737734
}
738735
}
739736

740-
internal void AssemblyRunCompleted(string assembly, string? targetFramework, string? architecture, string? executionId,
737+
internal void AssemblyRunCompleted(string assembly, string? targetFramework, string? architecture,
741738
// These parameters are useful only for "remote" runs in dotnet test, where we are reporting on multiple processes.
742739
// In single process run, like with testing platform .exe we report these via messages, and run exit.
743740
int? exitCode, string? outputData, string? errorData)
744741
{
745-
TestProgressState assemblyRun = GetOrAddAssemblyRun(assembly, targetFramework, architecture, executionId);
742+
TestProgressState assemblyRun = GetOrAddAssemblyRun(assembly, targetFramework, architecture);
746743
assemblyRun.Stopwatch.Stop();
747744

748745
_terminalWithProgress.RemoveWorker(assemblyRun.SlotIndex);
@@ -816,8 +813,8 @@ private static void AppendLongDuration(ITerminal terminal, TimeSpan duration, bo
816813

817814
public void Dispose() => _terminalWithProgress.Dispose();
818815

819-
public void ArtifactAdded(bool outOfProcess, string? assembly, string? targetFramework, string? architecture, string? executionId, string? testName, string path)
820-
=> _artifacts.Add(new TestRunArtifact(outOfProcess, assembly, targetFramework, architecture, executionId, testName, path));
816+
public void ArtifactAdded(bool outOfProcess, string? assembly, string? targetFramework, string? architecture, string? testName, string path)
817+
=> _artifacts.Add(new TestRunArtifact(outOfProcess, assembly, targetFramework, architecture, testName, path));
821818

822819
/// <summary>
823820
/// Let the user know that cancellation was triggered.
@@ -833,9 +830,9 @@ public void StartCancelling()
833830
});
834831
}
835832

836-
internal void WriteErrorMessage(string assembly, string? targetFramework, string? architecture, string? executionId, string text, int? padding)
833+
internal void WriteErrorMessage(string assembly, string? targetFramework, string? architecture, string text, int? padding)
837834
{
838-
TestProgressState asm = GetOrAddAssemblyRun(assembly, targetFramework, architecture, executionId);
835+
TestProgressState asm = GetOrAddAssemblyRun(assembly, targetFramework, architecture);
839836
asm.AddError(text);
840837

841838
_terminalWithProgress.WriteToTerminal(terminal =>
@@ -854,9 +851,9 @@ internal void WriteErrorMessage(string assembly, string? targetFramework, string
854851
});
855852
}
856853

857-
internal void WriteWarningMessage(string assembly, string? targetFramework, string? architecture, string? executionId, string text, int? padding)
854+
internal void WriteWarningMessage(string assembly, string? targetFramework, string? architecture, string text, int? padding)
858855
{
859-
TestProgressState asm = GetOrAddAssemblyRun(assembly, targetFramework, architecture, executionId);
856+
TestProgressState asm = GetOrAddAssemblyRun(assembly, targetFramework, architecture);
860857
asm.AddWarning(text);
861858
_terminalWithProgress.WriteToTerminal(terminal =>
862859
{
@@ -874,8 +871,8 @@ internal void WriteWarningMessage(string assembly, string? targetFramework, stri
874871
});
875872
}
876873

877-
internal void WriteErrorMessage(string assembly, string? targetFramework, string? architecture, string? executionId, Exception exception)
878-
=> WriteErrorMessage(assembly, targetFramework, architecture, executionId, exception.ToString(), padding: null);
874+
internal void WriteErrorMessage(string assembly, string? targetFramework, string? architecture, Exception exception)
875+
=> WriteErrorMessage(assembly, targetFramework, architecture, exception.ToString(), padding: null);
879876

880877
public void WriteMessage(string text, SystemConsoleColor? color = null, int? padding = null)
881878
{
@@ -916,11 +913,10 @@ internal void TestDiscovered(
916913
string assembly,
917914
string? targetFramework,
918915
string? architecture,
919-
string? executionId,
920916
string? displayName,
921917
string? uid)
922918
{
923-
TestProgressState asm = _assemblies[$"{assembly}|{targetFramework}|{architecture}|{executionId}"];
919+
TestProgressState asm = _assemblies[$"{assembly}|{targetFramework}|{architecture}"];
924920

925921
if (_isDiscovery)
926922
{
@@ -1028,10 +1024,9 @@ public void TestInProgress(
10281024
string? targetFramework,
10291025
string? architecture,
10301026
string testNodeUid,
1031-
string displayName,
1032-
string? executionId)
1027+
string displayName)
10331028
{
1034-
TestProgressState asm = _assemblies[$"{assembly}|{targetFramework}|{architecture}|{executionId}"];
1029+
TestProgressState asm = _assemblies[$"{assembly}|{targetFramework}|{architecture}"];
10351030

10361031
if (_options.ShowActiveTests)
10371032
{

src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TestRunArtifact.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ namespace Microsoft.Testing.Platform.OutputDevice.Terminal;
66
/// <summary>
77
/// An artifact / attachment that was reported during run.
88
/// </summary>
9-
internal sealed record TestRunArtifact(bool OutOfProcess, string? Assembly, string? TargetFramework, string? Architecture, string? ExecutionId, string? TestName, string Path);
9+
internal sealed record TestRunArtifact(bool OutOfProcess, string? Assembly, string? TargetFramework, string? Architecture, string? TestName, string Path);

src/Platform/Microsoft.Testing.Platform/OutputDevice/TerminalOutputDevice.cs

+8-19
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,11 @@ public async Task DisplayBannerAsync(string? bannerMessage)
256256
{
257257
if (_fileLoggerInformation.SyncronousWrite)
258258
{
259-
_terminalTestReporter.WriteWarningMessage(_assemblyName, _targetFramework, _shortArchitecture, executionId: null, string.Format(CultureInfo.CurrentCulture, PlatformResources.DiagnosticFileLevelWithFlush, _fileLoggerInformation.LogLevel, _fileLoggerInformation.LogFile.FullName), padding: null);
259+
_terminalTestReporter.WriteWarningMessage(_assemblyName, _targetFramework, _shortArchitecture, string.Format(CultureInfo.CurrentCulture, PlatformResources.DiagnosticFileLevelWithFlush, _fileLoggerInformation.LogLevel, _fileLoggerInformation.LogFile.FullName), padding: null);
260260
}
261261
else
262262
{
263-
_terminalTestReporter.WriteWarningMessage(_assemblyName, _targetFramework, _shortArchitecture, executionId: null, string.Format(CultureInfo.CurrentCulture, PlatformResources.DiagnosticFileLevelWithAsyncFlush, _fileLoggerInformation.LogLevel, _fileLoggerInformation.LogFile.FullName), padding: null);
263+
_terminalTestReporter.WriteWarningMessage(_assemblyName, _targetFramework, _shortArchitecture, string.Format(CultureInfo.CurrentCulture, PlatformResources.DiagnosticFileLevelWithAsyncFlush, _fileLoggerInformation.LogLevel, _fileLoggerInformation.LogFile.FullName), padding: null);
264264
}
265265
}
266266
}
@@ -281,7 +281,7 @@ public async Task DisplayBeforeSessionStartAsync()
281281
// Start test execution here, rather than in ShowBanner, because then we know
282282
// if we are a testHost controller or not, and if we should show progress bar.
283283
_terminalTestReporter.TestExecutionStarted(_clock.UtcNow, workerCount: 1, isDiscovery: _isListTests);
284-
_terminalTestReporter.AssemblyRunStarted(_assemblyName, _targetFramework, _shortArchitecture, executionId: null);
284+
_terminalTestReporter.AssemblyRunStarted(_assemblyName, _targetFramework, _shortArchitecture);
285285
if (_logger is not null && _logger.IsEnabled(LogLevel.Trace))
286286
{
287287
await _logger.LogTraceAsync("DisplayBeforeSessionStartAsync");
@@ -316,7 +316,7 @@ private async Task DisplayAfterSessionEndRunInternalAsync()
316316
{
317317
if (!_firstCallTo_OnSessionStartingAsync)
318318
{
319-
_terminalTestReporter.AssemblyRunCompleted(_assemblyName, _targetFramework, _shortArchitecture, executionId: null, exitCode: null, outputData: null, errorData: null);
319+
_terminalTestReporter.AssemblyRunCompleted(_assemblyName, _targetFramework, _shortArchitecture, exitCode: null, outputData: null, errorData: null);
320320
_terminalTestReporter.TestExecutionCompleted(_clock.UtcNow);
321321
}
322322
}
@@ -372,17 +372,17 @@ public async Task DisplayAsync(IOutputDeviceDataProducer producer, IOutputDevice
372372

373373
case WarningMessageOutputDeviceData warningData:
374374
await LogDebugAsync(warningData.Message);
375-
_terminalTestReporter.WriteWarningMessage(_assemblyName, _targetFramework, _shortArchitecture, executionId: null, warningData.Message, null);
375+
_terminalTestReporter.WriteWarningMessage(_assemblyName, _targetFramework, _shortArchitecture, warningData.Message, null);
376376
break;
377377

378378
case ErrorMessageOutputDeviceData errorData:
379379
await LogDebugAsync(errorData.Message);
380-
_terminalTestReporter.WriteErrorMessage(_assemblyName, _targetFramework, _shortArchitecture, executionId: null, errorData.Message, null);
380+
_terminalTestReporter.WriteErrorMessage(_assemblyName, _targetFramework, _shortArchitecture, errorData.Message, null);
381381
break;
382382

383383
case ExceptionOutputDeviceData exceptionOutputDeviceData:
384384
await LogDebugAsync(exceptionOutputDeviceData.Exception.ToString());
385-
_terminalTestReporter.WriteErrorMessage(_assemblyName, _targetFramework, _shortArchitecture, executionId: null, exceptionOutputDeviceData.Exception);
385+
_terminalTestReporter.WriteErrorMessage(_assemblyName, _targetFramework, _shortArchitecture, exceptionOutputDeviceData.Exception);
386386
break;
387387
}
388388
}
@@ -413,16 +413,14 @@ public Task ConsumeAsync(IDataProducer dataProducer, IData value, CancellationTo
413413
_targetFramework,
414414
_shortArchitecture,
415415
testNodeStateChanged.TestNode.Uid.Value,
416-
testNodeStateChanged.TestNode.DisplayName,
417-
executionId: null);
416+
testNodeStateChanged.TestNode.DisplayName);
418417
break;
419418

420419
case ErrorTestNodeStateProperty errorState:
421420
_terminalTestReporter.TestCompleted(
422421
_assemblyName,
423422
_targetFramework,
424423
_shortArchitecture,
425-
executionId: null,
426424
testNodeStateChanged.TestNode.Uid.Value,
427425
testNodeStateChanged.TestNode.DisplayName,
428426
TestOutcome.Error,
@@ -441,7 +439,6 @@ public Task ConsumeAsync(IDataProducer dataProducer, IData value, CancellationTo
441439
_assemblyName,
442440
_targetFramework,
443441
_shortArchitecture,
444-
executionId: null,
445442
testNodeStateChanged.TestNode.Uid.Value,
446443
testNodeStateChanged.TestNode.DisplayName,
447444
TestOutcome.Fail,
@@ -460,7 +457,6 @@ public Task ConsumeAsync(IDataProducer dataProducer, IData value, CancellationTo
460457
_assemblyName,
461458
_targetFramework,
462459
_shortArchitecture,
463-
executionId: null,
464460
testNodeStateChanged.TestNode.Uid.Value,
465461
testNodeStateChanged.TestNode.DisplayName,
466462
TestOutcome.Timeout,
@@ -479,7 +475,6 @@ public Task ConsumeAsync(IDataProducer dataProducer, IData value, CancellationTo
479475
_assemblyName,
480476
_targetFramework,
481477
_shortArchitecture,
482-
executionId: null,
483478
testNodeStateChanged.TestNode.Uid.Value,
484479
testNodeStateChanged.TestNode.DisplayName,
485480
TestOutcome.Canceled,
@@ -498,7 +493,6 @@ public Task ConsumeAsync(IDataProducer dataProducer, IData value, CancellationTo
498493
_assemblyName,
499494
_targetFramework,
500495
_shortArchitecture,
501-
executionId: null,
502496
testNodeStateChanged.TestNode.Uid.Value,
503497
testNodeStateChanged.TestNode.DisplayName,
504498
outcome: TestOutcome.Passed,
@@ -517,7 +511,6 @@ public Task ConsumeAsync(IDataProducer dataProducer, IData value, CancellationTo
517511
_assemblyName,
518512
_targetFramework,
519513
_shortArchitecture,
520-
executionId: null,
521514
testNodeStateChanged.TestNode.Uid.Value,
522515
testNodeStateChanged.TestNode.DisplayName,
523516
TestOutcome.Skipped,
@@ -536,7 +529,6 @@ public Task ConsumeAsync(IDataProducer dataProducer, IData value, CancellationTo
536529
_assemblyName,
537530
_targetFramework,
538531
_shortArchitecture,
539-
executionId: null,
540532
testNodeStateChanged.TestNode.DisplayName,
541533
testNodeStateChanged.TestNode.Uid);
542534
break;
@@ -552,7 +544,6 @@ public Task ConsumeAsync(IDataProducer dataProducer, IData value, CancellationTo
552544
_assemblyName,
553545
_targetFramework,
554546
_shortArchitecture,
555-
executionId: null,
556547
artifact.TestNode.DisplayName,
557548
artifact.FileInfo.FullName);
558549
}
@@ -567,7 +558,6 @@ public Task ConsumeAsync(IDataProducer dataProducer, IData value, CancellationTo
567558
_assemblyName,
568559
_targetFramework,
569560
_shortArchitecture,
570-
executionId: null,
571561
testName: null,
572562
artifact.FileInfo.FullName);
573563
}
@@ -581,7 +571,6 @@ public Task ConsumeAsync(IDataProducer dataProducer, IData value, CancellationTo
581571
_assemblyName,
582572
_targetFramework,
583573
_shortArchitecture,
584-
executionId: null,
585574
testName: null,
586575
artifact.FileInfo.FullName);
587576
}

0 commit comments

Comments
 (0)