XUnit code lens (run test, debug test) not appear in solution workspace
See original GitHub issueFrom @luktar on December 21, 2017 18:25
VScode version: 1.19 OS: Mac OS X Hight Sierra
Similar https://github.com/OmniSharp/omnisharp-vscode/issues/1292
XUnit code lens appears in the project like workspace (one project only - csproj on top level). XUnit code lens does not appear in the solution like workspace (sln on a top level, projects inside folders).
Steps to reproduce:
- Create solution ‘dotnet new sln’
- Create test folder ‘mkdir Test’, ‘cd ./Test’
- Create test project ‘create classlib’
- Put this to csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
</ItemGroup>
</Project>
- Open workspace on csproj level, open test class - code lens appears.
- Open workspace on sln level, open test class - code lens doesn’t appear.
Copied from original issue: Microsoft/vscode#40666
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Getting Debug Test option in code lens in VSCode for NUnit ...
"Run Test"/"Debug Test" is not showing up in Code Lens for a particular C# project. This particular project is using the NUnit test...
Read more >Debug / Run part of unit test CodeLens for is not showing
Create new unit test project, build it. ... This issue is read only, because it has been in the Closed - Fixed state...
Read more >Getting Debug Test Option In Code Lens In Vscode For Nunit C#
With a test file open, select the Run Test CodeLens adornment that appears above a test with "request":"test" , the first definition will...
Read more >NETCore.With("vsCode").Should().Have("Unit Tests") - Xpirit
NET Core framework and the VS Code editor. We assume you have a basic understanding of unit testing and mocking in .
Read more >Automatic Unit Testing in .NET Core plus Code Coverage in ...
NET Core as expected. That means we can just "dotnet test" and it'll build and run tests. Added coverlet, which integrates with MSBuild...
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
Glad to see that everything is working properly. Thanks for following up!
Hello @DustinCampbell . I mean that I forgot to add a step with adding a test project to the solution.
Everything is working fine!
I don’t know the reason what was wrong.
I’ve made small research and I tried to reproduce exact environment for not showing code leans descriptions for tests. I had two solution types in one directory. I can’t edit test description, so I’ve made new below:
Create new ConsoleApplication in regular .Net (I used 4.6.1) by Visual Studio 2017 in directory X.
Create solution
dotnet new sln -n CodeLensTest
Create test folder
mkdir Test
,cd ./Test
Create test project
dotnet new classlib
Add project to solution
dotnet sln ../CodeLensTest.sln add ./test.csproj
Add this code to
./Test/Class1.cs
Build project
cd ..
dotnet build CodeLensTest.sln
In VSCode open workspace on
.Test/test.csproj level
, open test class - code lens appears.In another window of VSCode open workspace on
./CodeLensTest.sln
level, open test class - code lens doesn’t appear.In step 10 VSCode shows code lens!
csproj level:
sln level: