Implement VSTest support to enable running and debugging .NET Core tests in .csproj projects
See original GitHub issueI realize I’m on pretty bleeding edge (.NET Core 1.1.0, .NET CLI 1.0.0 preview 4 (csproj), etc) but wanted to raise this and see if I can help w/ anything.
Environment data
.NET Core version
Microsoft .NET Core Shared Framework Host
Version : 1.1.0
Build : 928f77c4bc3f49d892459992fb6e1d5542cb5e86
dotnet --info
output:
.NET Command Line Tools (1.0.0-preview4-004233)
Product Information:
Version: 1.0.0-preview4-004233
Commit SHA-1 hash: 8cec61c6f7
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.12
OS Platform: Darwin
RID: osx.10.11-x64
Base Path: /usr/local/share/dotnet/sdk/1.0.0-preview4-004233
VS Code version:
Version 1.8.1 (1.8.1)
C# Extension version:
1.6.2
Steps to reproduce
Create new xunit project
dotnet new -t xunittest
Update references to 1.1.0 in csproj:
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161123-03" />
<PackageReference Include="xunit" Version="2.2.0-beta4-build3444" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
</ItemGroup>
</Project>
Open in VS Code and navigate to Test.cs. Run Test via Omnisharp
Expected behavior
Test runs
Actual behavior
“Failed to run test because null” error
Issue Analytics
- State:
- Created 7 years ago
- Reactions:27
- Comments:65 (38 by maintainers)
Top Results From Across the Web
dotnet vstest command - .NET CLI
The dotnet vstest command builds a project and all of its dependencies. ... dotnet vstest - Runs tests from the specified assemblies.
Read more >Testing .NET Core Apps with Visual Studio Code
The simplest way to run a test in a .NET Core app is from the command line. The dotnet test command will find...
Read more >Interactive Unit Testing with .NET Core and VS Code
The first step is to establish a class library project. To do that, you need to create a terminal instance. There are two...
Read more >.NET Core Test Explorer - Visual Studio Marketplace
Open a .NET Core test project, or set dotnet-test-explorer.testProjectPath to the folder path of .NET Core test project. Then, you ...
Read more >ReSharper, .NET Core and unit testing
ReSharper also supports debugging .NET Core tests, just like traditional .NET Framework projects – just set the breakpoint and select “Debug ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FYI that I’m working on getting this implemented in OmniSharp right now. Hopefully I should have something early next week.
FYI to all watching this issue that I have things working on machine. There’s probably a day or two of getting my changes both omnisharp-roslyn and omnisharp-vscode into shape for merging.
@gregg-miskelly: As part of this change, I’m planning to switch over to attaching the debugger to the test process for .csproj projects. The VS Test protocol makes launching the test process under the debugger problematic. The biggest issue with this that I can see is that the user is presented with a “disconnect” button rather than a stop button. Do you foresee any other problems?