-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement simple LSP run tests #68889
Conversation
[ExportLanguageService(typeof(ITestMethodFinder), LanguageNames.CSharp), Shared] | ||
[method: ImportingConstructor] | ||
[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] | ||
internal class CSharpTestMethodFinder([ImportMany] IEnumerable<ITestFrameworkMetadata> testFrameworks) : AbstractTestMethodFinder<MethodDeclarationSyntax>(testFrameworks) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abstracted out because we have language specific details here.
namespace Microsoft.CodeAnalysis.LanguageServer; | ||
|
||
[Export, Shared] | ||
internal class DotnetCliHelper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need access to various dotnet components for two operations currently
- We need to run a
dotnet build
to ensure the project is up to date - We need to find the vstest.console.dll from the appropriate dotnet SDK directory.
src/Features/Core/Portable/Testing/TestFrameworks/ITestFrameworkMetadata.cs
Show resolved
Hide resolved
src/Features/Core/Portable/Testing/TestFrameworks/MSTestTestFrameworkMetadata.cs
Outdated
Show resolved
Hide resolved
src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/DotnetCliHelper.cs
Outdated
Show resolved
Hide resolved
src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/DotnetCliHelper.cs
Show resolved
Hide resolved
src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/DotnetCliHelper.cs
Show resolved
Hide resolved
src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/DotnetCliHelper.cs
Show resolved
Hide resolved
src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/DotnetCliHelper.cs
Outdated
Show resolved
Hide resolved
src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Testing/TestDiscoverer.cs
Show resolved
Hide resolved
src/Features/Core/Portable/Testing/TestFrameworks/ITestFrameworkMetadata.cs
Show resolved
Hide resolved
src/Features/Core/Portable/Testing/TestFrameworks/MSTestTestFrameworkMetadata.cs
Outdated
Show resolved
Hide resolved
Contract.ThrowIfFalse(File.Exists(vstestConsole), $"VSTestConsole was not found at {vstestConsole}"); | ||
return vstestConsole; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my eyes glazed over her.e i trust you :)
src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/ServerConfigurationFactory.cs
Outdated
Show resolved
Hide resolved
src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Testing/RunTestsHandler.cs
Outdated
Show resolved
Hide resolved
_ => throw new InvalidOperationException($"Unexpected log level {serverConfiguration.MinimumLogLevel}"), | ||
}; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glazed over here as well.
...guageServer/Microsoft.CodeAnalysis.LanguageServer/Testing/TestDiscoverer.DiscoveryHandler.cs
Show resolved
Hide resolved
src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Testing/TestDiscoverer.cs
Outdated
Show resolved
Hide resolved
@@ -231,4 +231,56 @@ void UseM() | |||
var firstDocumentResult2 = await testLspServer.ExecuteRequestAsync<LSP.CodeLens, LSP.CodeLens>(LSP.Methods.CodeLensResolveName, firstCodeLens, CancellationToken.None); | |||
Assert.NotNull(firstDocumentResult2?.Command?.Title); | |||
} | |||
|
|||
[Theory, CombinatorialData] | |||
public async Task TestHasRunTestsCommandAsync(bool mutatingLspWorkspace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add another two tests covering the basic scenario of NUnit and MSTest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for now I'll skip these:
- The nunit / mstest finding is already exercised in a bunch of other tests at a lower layer, and the codelens code itself doesn't know about them (the command is entirely generic)
- I want to avoid another round of CI here.
I'll look at adding them when I do the debugging part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like what we can do best ... right now 🙂
A few minor sugguestions.
First part of dotnet/vscode-csharp#5719
Implements the server side code to handle the run tests command and the codelens for the same.
Client side PR - dotnet/vscode-csharp#5897
The general runtests approach is as follows
Followups in next PRs