question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

XUnit Tests Do Not Show Passing or Failing in Test Explorer with DisplayName Specified

See original GitHub issue

As the title says, tests with the DisplayName specified do not show up correctly in the test explorer; though the actual dotnet test command does appear to run the tests and the console output shows the correct pass/fail numbers.

This works:

[Fact]
public void TestMethod() { Assert.True(true); } 

This does not (though dotnet test output shows tests pass)

[Fact(DisplayName="The Test Method")]
public void TestMethod() { Assert.True(true); } 

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
Ghostbirdcommented, Dec 5, 2018

Might this be related to an issue I have?

[Fact(DisplayName = "Item: Creation")]
public void CreateItem() { }

When test discovery runs I see CreateItem in the list of tests. When I click the play icon next to CreateItem, the test runs. Once the test passed or failed, I seen an additional test in the list: Item: Creation with the correct status. The original CreateItem is still in the list and the icon indicates that it was not run. When I click the play icon next to Item: Creation I get an error message saying that the test was not found.

2reactions
stefanforsbergcommented, Apr 14, 2018

The display name makes xunit behave like nunit/mstest with regards to output from dotnet test -t. This will be fixed with #51.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tests not running in Test Explorer - visual studio
Check what framework the tests are written against (e.g. nunit, xunit, VS test, etc.) and make sure you've got the correct test adapter/runner...
Read more >
dotnet test command - .NET CLI | Microsoft Learn
The dotnet test command is used to execute unit tests in a given ... NUnit, or xUnit, and reports the success or failure...
Read more >
Writing xUnit Tests in .NET Core - Visual Studio Magazine
In Test Explorer this test will appear under the heading Customer [Update] (each Name/Value combination appears as a separate heading in Test ...
Read more >
Tips and Tricks | NUnit Docs
Certain NUnit Test Adapter settings are configurable using a .runsettings file. ... DefaultTestNamePattern, string, Pattern for display name, {m}{a}.
Read more >
.NET Core Test Explorer - Visual Studio Marketplace
Extension for Visual Studio Code - Test Explorer for .NET Core (MSTest, xUnit, NUnit) ... Then, you will see all the tests in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found