Skip to content

Commit

Permalink
Move debugging messages behind internal diagnostics flag
Browse files Browse the repository at this point in the history
  • Loading branch information
bradwilson committed Jul 17, 2024
1 parent 804749b commit 9942a1e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/xunit.runner.visualstudio/VsTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public static IReadOnlyList<IRunnerReporter> GetAvailableRunnerReporters(

if (logger is not null)
foreach (var message in messages)
logger.LogWarning(message);
logger.LogWarning("{0}", message);
}

return result;
Expand Down Expand Up @@ -508,8 +508,6 @@ async Task RunTestsInAssembly(
var testCaseSerializations = new List<string>();
if (runInfo.TestCases is null || !runInfo.TestCases.Any())
{
logger.LogWithSource(assemblyFileName, "Discovering tests for full assembly execution");

// Discover tests
var assemblyDiscoveredInfo = default(AssemblyDiscoveredInfo);
await DiscoverTestsInAssembly(
Expand Down Expand Up @@ -556,18 +554,16 @@ await DiscoverTestsInAssembly(
testCaseSerializations.Add(filteredTestCase.TestCase.Serialization);
}
}

logger.LogWithSource(assemblyFileName, "Discovery complete");
}
else
{
logger.LogWithSource(assemblyFileName, "Selective execution requested for the following test case serializations:");

foreach (var testCase in runInfo.TestCases)
{
var uniqueID = testCase.GetPropertyValue<string>(TestCaseUniqueIDProperty, null);
var serialization = testCase.GetPropertyValue<string>(TestCaseSerializationProperty, null);
logger.LogWithSource(assemblyFileName, " {0} :: {1}", uniqueID ?? "(null)", serialization ?? "(null)");

if (discoveryOptions.GetInternalDiagnosticMessagesOrDefault())
logger.LogWithSource(assemblyFileName, "Selective execution requested for test case ID '{0}' (serialization = '{1}')", uniqueID ?? "(null)", serialization ?? "(null)");

if (uniqueID is null)
logger.LogWarningWithSource(assemblyFileName, "VSTestCase {0} did not have an associated unique ID", testCase.DisplayName);
Expand Down

0 comments on commit 9942a1e

Please sign in to comment.