Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ internal async Task RunTestsAsync(IEnumerable<TestCase>? tests, IRunContext? run
throw new ArgumentNullException(nameof(frameworkHandle));
}

// TODO: Verify why VSTest annotates the IEnumerable as nullable.
// VSTest annotates the IEnumerable as nullable; the exact reason is unclear.
if (tests is null)
{
throw new ArgumentNullException(nameof(tests));
Expand Down Expand Up @@ -203,7 +203,7 @@ private async Task RunTestsFromSourcesCoreAsync(IEnumerable<string>? sources, IR
throw new ArgumentNullException(nameof(frameworkHandle));
}

// TODO: Verify why VSTest annotates the IEnumerable as nullable.
// VSTest annotates the IEnumerable as nullable; the exact reason is unclear.
if (sources is null)
{
throw new ArgumentNullException(nameof(sources));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override List<string> GetDataTablesAndViews()

SchemaMetaData[] metadatas = GetSchemaMetaData();

// TODO: may be find better way to enumerate tables/views.
// There may be a better way to enumerate tables/views.
foreach (SchemaMetaData metadata in metadatas)
{
DataTable? dataTable = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ private static bool TryUnfoldITestDataSources(UnitTestElement test, DiscoveryTes
isDataDriven = true;
if (!TryUnfoldITestDataSource(dataSource, test, new(testMethodInfo.MethodInfo, test.TestMethod.DisplayName), tempListOfTests, ref globalTestCaseIndex, mustSerialize))
{
// TODO: Improve multi-source design!
// The multi-source design could be improved.
// Ideally we would want to consider each data source separately but when one source cannot be expanded,
// we will run all sources from the given method so we need to bail-out "globally".
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ internal UnitTestElement GetTestFromMethod(MethodInfo method, bool classDisables
MethodInfo = method,
};

// TODO: For every test method in a class, we are asking reflect helper multiple times for the same
// For every test method in a class, we are asking reflect helper multiple times for the same
// information (like test categories, traits, deployment items) which is not optimal.
IReflectionOperations reflectionOperations = PlatformServiceProvider.Instance.ReflectionOperations;
var testElement = new UnitTestElement(testMethod)
Expand Down Expand Up @@ -195,7 +195,7 @@ internal UnitTestElement GetTestFromMethod(MethodInfo method, bool classDisables

// In production, we always have a TestMethod attribute because GetTestFromMethod is called under IsValidTestMethod
// In unit tests, we may not have the test to have TestMethodAttribute.
// TODO: Adjust all unit tests to properly have the attribute and uncomment the assert.
// Unit tests could be adjusted to properly have the attribute so the assert can be uncommented.
// DebugEx.Assert(testMethodAttribute is not null, "Expected to find a 'TestMethod' attribute.");

// get DisplayName from TestMethodAttribute (or any inherited attribute)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal static class ExceptionHelper
curException != null;
curException = curException.InnerException)
{
// TODO:Fix the shadow stack-trace used in Private Object
// The shadow stack-trace used in Private Object could be improved.
// (Look-in Assertion.cs in the UnitTestFramework assembly)

// Sometimes the stack trace can be null, but the inner stack trace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private async Task<TestResult> ExecuteInternalAsync(object?[]? arguments, Cancel
}
}

// TODO remove dry violation with TestMethodRunner
// This duplicates logic in TestMethodRunner (DRY violation).
bool setTestContextSucessful = false;
if (_executionContext is null)
{
Expand Down Expand Up @@ -348,7 +348,7 @@ async SynchronizationContextPreservingTask<TestResult> ExecuteWithTimeoutTokenAs

TestResult timeoutResult = new() { Outcome = UnitTestOutcome.Timeout, TestFailureException = new TestFailedException(UnitTestOutcome.Timeout, errorMessage) };

// TODO: execution context propagation here may still not be accurate.
// Execution context propagation here may still not be accurate.
// if test init was successfully executed by ExecuteAsyncAction, but then the test itself timed out or cancelled,
// then at this point we will run the cleanup on an execution context that doesn't have any state set by the test initialize.

Expand All @@ -362,7 +362,7 @@ void ExecuteAsyncAction()
{
try
{
// TODO: Avoid blocking.
// Ideally this would avoid blocking.
// This used to always happen, but now is moved to the code path where there is a Timeout on the test method.
// The GetAwaiter().GetResult() call here can be a source of deadlocks, especially for UWP/WinUI.
// When the test method has `await`s with ConfigureAwait(true) (which is the default), the continuation is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ private static MethodInfo ConstructGenericMethod(MethodInfo methodInfo, Paramete

for (int i = 0; i < map.Length; i++)
{
// TODO: Better to throw? or tolerate and transform to typeof(object)?
// It is unclear whether it is better to throw here or tolerate and transform to typeof(object).
// This is reachable in the following case for example:
// [DataRow(null)]
// public void TestMethod<T>(T t) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Helpers;
internal static class RuntimeContext
{
private static readonly Lazy<bool> IsHotReloadEnabledLazy = new(() =>
// TODO: We should be using a capability from the runner instead of looking at environment variables.
// Ideally we would use a capability from the runner instead of looking at environment variables.
Environment.GetEnvironmentVariable("DOTNET_WATCH") == "1"
|| Environment.GetEnvironmentVariable("TESTINGPLATFORM_HOTRELOAD_ENABLED") == "1");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ internal static void SetAppDomainFrameworkVersionBasedOnTestSource(AppDomainSetu
/// The path of the dll.
/// </param>
/// <returns>
/// Framework string
/// TODO: Need to add components/E2E tests to cover these scenarios.
/// Framework string.
/// </returns>
/// <remarks>
/// Components/E2E tests could be added to cover these scenarios.
/// </remarks>
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "Reviewed. Suppression is OK here.")]
internal static string GetTargetFrameworkVersionString(string testSourcePath)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ internal static IList<DeploymentItem> GetDeploymentItems(IEnumerable<UnitTestEle

IList<DeploymentItem>? deploymentItemsToBeAdded = FromKeyValuePairs(items);

// TODO: Check if we can avoid potential NRE here.
// deploymentItemsToBeAdded is never null here: items is non-empty (filtered above) and FromKeyValuePairs only returns null for an empty array.
foreach (DeploymentItem deploymentItemToBeAdded in deploymentItemsToBeAdded!)
{
AddDeploymentItem(allDeploymentItems, deploymentItemToBeAdded);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private static int CountStatements(IBlockOperation blockOperation)
// Skip implicit return/labeled operations.
// Implicit returns don't represent user code.
// Implicit labeled operations seem to be created for lambdas only under VB. But we don't do a language check.
// TODO: Should we bail-out for any implicit operation?
// It is unclear whether we should bail out for any implicit operation.
if (operation is IReturnOperation or ILabeledOperation && operation.IsImplicit)
{
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public sealed class AssertionArgsShouldAvoidConditionalAccessAnalyzer : Diagnost
("AreNotEqual", 2),
("AreEquivalent", 2),
("AreNotEquivalent", 2),
// TODO: Is it really bad to have Assert.Contains(myCollection, expression_with_conditional_access)? A codefix seems like may not always yield the correct result for this case.
// TODO: Maybe we should check one argument only (the collection itself)
// It is unclear whether CollectionAssert.Contains(myCollection, expression_with_conditional_access) is genuinely problematic; a codefix may not always yield the correct result for this case.
// We might only need to check one argument (the collection itself).
// Same applies to DoesNotContain
("Contains", 2),
("DoesNotContain", 2),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ public static Diagnostic CreateDiagnostic(
=> syntaxReference.GetSyntax(cancellationToken).CreateDiagnostic(rule, args);

/// <summary>
/// TODO: Revert this reflection based workaround once we move to Microsoft.CodeAnalysis version 3.0
/// Reflection is used to read diagnostic severity overrides in a way that works across Microsoft.CodeAnalysis versions:
/// 'CompilationOptions.SyntaxTreeOptionsProvider' is preferred (>= 3.7) and the deprecated 'SyntaxTree.DiagnosticOptions' is used as a fallback (3.3 - 3.7).
/// </summary>
private static readonly PropertyInfo? s_syntaxTreeDiagnosticOptionsProperty =
typeof(SyntaxTree).GetTypeInfo().GetDeclaredProperty("DiagnosticOptions");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public async Task<AzureDevOpsCoordinatedRun> AcquireRunAsync(AzureDevOpsPublishC
throw new InvalidOperationException(AzureDevOpsResources.AzureDevOpsLivePublishingRunIdFileMismatch);
}

// TODO: Elect a deterministic surviving participant when the owner lease expires before writing azdo-runid.<buildId>.json.
// A deterministic surviving participant could be elected when the owner lease expires before writing azdo-runid.<buildId>.json.
throw new InvalidOperationException(AzureDevOpsResources.AzureDevOpsLivePublishingMissingRunIdFile);
}
catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal sealed class QuarantineFile
private const int MaxPatternCount = 10_000;
private const int MaxPatternLength = 4 * 1024;

// TODO: Consider an opt-in modifier for case-insensitive quarantine matching if customer scenarios require it.
// An opt-in modifier for case-insensitive quarantine matching could be added if customer scenarios require it.
private static readonly RegexOptions RegexOptions = RegexOptions.CultureInvariant;

private readonly Regex[] _patterns;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ await _logger.LogDebugAsync($"""
// This tells the TestHostController process the info of the registered ITestFramework.
// The TestHostController needs that info to create the TrxReportEngine so that the info are written to the TRX file.
// Note: TestHostController cannot retrieve ITestFramework from service provider which is why we need the extra complexity here.
// TODO: Investigate if TestHostController can/should have access to ITestFramework and simplify this.
// It would be worth investigating whether TestHostController can/should have access to ITestFramework to simplify this.
await _trxTestApplicationLifecycleCallbacks.NamedPipeClient.RequestReplyAsync<TestAdapterInformationRequest, VoidResponse>(new TestAdapterInformationRequest(_testFramework.Uid, _testFramework.Version), cancellationToken)
.TimeoutAfterAsync(TimeoutHelper.DefaultHangTimeSpanTimeout, cancellationToken).ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal sealed partial class TrxReportEngine
{
private void AddResultSummary(XElement testRun, string resultSummaryOutcome, string runDeploymentRoot, string testHostCrashInfo, int exitCode, SummaryCounts summaryCounts, List<string> attachmentWarnings, bool isTestHostCrashed = false)
{
// TODO: VSTest adds Output/StdOut element to ResultSummary which we don't add.
// Unlike VSTest, we do not add an Output/StdOut element to ResultSummary.
// VSTest adds mainly two things in that element:
// 1. Skipped test messages (see AddRunLevelInformationalMessage call in HandleSkippedTest in VSTest's TrxLogger implementation)
// 2. Messages published with TestMessageLevel.Informational.
Expand Down Expand Up @@ -43,7 +43,7 @@ private void AddResultSummary(XElement testRun, string resultSummaryOutcome, str
new XAttribute("pending", 0));
resultSummary.Add(counters);

// TODO: VSTest adds two additional things to RunInfos
// VSTest adds two additional things to RunInfos.
// 1. Messages published with TestMessageLevel.Warning or TestMessageLevel.Error
// 2. Errors when constructing result files.
// In addition, in these cases, it turns TRX outcome to error.
Expand All @@ -59,8 +59,8 @@ private void AddResultSummary(XElement testRun, string resultSummaryOutcome, str

if (_artifactsByExtension.Count != 0)
{
// TODO: VSTest seems to also add ResultFiles element, and not only CollectorDataEntries.
// TODO: Revise VSTest implementation for Converter.ToCollectionEntries and Converter.ToResultFiles
// VSTest seems to also add a ResultFiles element, and not only CollectorDataEntries.
// Whether this reporter should also emit ResultFiles here could be revisited by referencing VSTest's Converter.ToCollectionEntries and Converter.ToResultFiles.
var collectorDataEntries = new XElement(NamespaceUri + "CollectorDataEntries");
resultSummary.Add(collectorDataEntries);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private static XElement CreateUnitTestElementForTestDefinition(string testDefini
unitTest.Add(properties);
}

// TODO: We are not adding Workitems, but VSTest does.
// Unlike VSTest, we do not add Workitems.
return unitTest;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ private SummaryCounts AddResults(IReadOnlyList<TrxTestResult> testResults, strin
unitTestResult.Add(output);
}

// TODO: VSTest used to store the relative paths in a sorted list (ignoring case).
// TODO: VSTest is able to classify per-test attachments into two categories:
// VSTest used to store the relative paths in a sorted list (ignoring case).
// VSTest is able to classify per-test attachments into two categories:
// 1. ResultFiles
// 2. CollectorDataEntries
// So far, we only have "ResultFiles".
Expand Down Expand Up @@ -287,7 +287,7 @@ private SummaryCounts AddResults(IReadOnlyList<TrxTestResult> testResults, strin
? methodIdentifier.TypeName
: $"{methodIdentifier.Namespace}.{methodIdentifier.TypeName}";

// TODO: Are we expected to append backtick and arity here for generic methods?
// It is unclear whether we are expected to append backtick and arity here for generic methods.
return (classNameFromIdentifierProperty, methodIdentifier.MethodName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ public TrxReportEngine(
testRunId = Guid.NewGuid();
}

// TODO: VSTest implementation seems to also add "runUser" attribute.
// Revise that.
// Unlike the VSTest implementation, this reporter does not currently add a "runUser" attribute.
testRun.SetAttributeValue("id", testRunId);
string testRunName = $"{_environment.GetEnvironmentVariable("UserName")}@{_environment.MachineName} {FormatDateTimeForRunName(_clock.UtcNow)}";
testRun.SetAttributeValue("name", testRunName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace Microsoft.Testing.Extensions.VSTestBridge.Helpers;

internal static class RunSettingsHelpers
{
// TODO: There are two code paths that read runsettings. One is calling the ICommandLineOptions overload, other is calling the CommandLineParseResult overload.
// Figure out if they can/should be unified so that we do one I/O operation instead of two.
// There are two code paths that read runsettings. One calls the ICommandLineOptions overload, the other calls the CommandLineParseResult overload.
// It is unclear whether they can/should be unified so that a single I/O operation is done instead of two.
public static string ReadRunSettings(ICommandLineOptions commandLineOptions, IFileSystem fileSystem)
{
_ = commandLineOptions.TryGetOptionArgumentList(RunSettingsCommandLineOptionsProvider.RunSettingsOptionName, out string[]? fileNames);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public static TestNode ToTestNode(
TestMethodIdentifierProperty? testMethodIdentifierProperty = testNode.Properties.SingleOrDefault<TestMethodIdentifierProperty>();
if (testMethodIdentifierProperty is not null)
{
// TODO: Should TRX className have arity for generic classes?
// It is unclear whether the TRX className should have arity for generic classes.
if (RoslynString.IsNullOrEmpty(testMethodIdentifierProperty.Namespace))
{
testNode.Properties.Add(new TrxFullyQualifiedTypeNameProperty(testMethodIdentifierProperty.TypeName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public RunSettingsAdapter(
public string? SettingsXml { get; }

/// <inheritdoc />
// TODO: Needs to be implemented if used by adapters. It is not used by MSTest.
// Needs to be implemented if used by adapters. It is not used by MSTest.
public ISettingsProvider? GetSettings(string? settingsName) => throw new NotImplementedException();

private static void WarnOnUnsupportedEntries(XDocument document, IMessageLogger messageLogger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public async Task<int> RunAsync()

string toolNameToRun = _commandLineHandler.ParseResult.ToolName;

// TODO: Apply the override or do not support it for Tools?
// TODO: Verify reserved tool names?
// It is unclear whether the override should be applied or simply not supported for Tools.
// Reserved tool names may also need to be verified.
_toolsInformation.GroupBy(x => x.Name).Where(x => x.Count() > 1).ToList()
.ForEach(x => throw new InvalidOperationException($"Tool '{x.Key}' is registered more than once."));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void StartBusyIndicator()
// nop
}

// TODO: Refactor NonAnsiTerminal and AnsiTerminal such that we don't need StartUpdate/StopUpdate.
// NonAnsiTerminal and AnsiTerminal could be refactored such that we don't need StartUpdate/StopUpdate.
// It's much better if we use lock C# keyword instead of manually calling Monitor.Enter/Exit
// Using lock also ensures we don't accidentally have `await`s in between that could cause Exit to be on a different thread.
public void StartUpdate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting;
/// </code>
/// </example>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)]
// TODO: This API should not exist in the netstandard2.0 build, because it's not available in UWP/WinUI.
// This API should not exist in the netstandard2.0 build, because it's not available in UWP/WinUI.
// This is a binary breaking change, however.
public sealed class DeploymentItemAttribute : Attribute
{
Expand Down
Loading
Loading