Skip to content
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

[BUG] No output recorded after unit testing using xUnit #159

Open
sharpchen opened this issue Jun 16, 2023 · 7 comments
Open

[BUG] No output recorded after unit testing using xUnit #159

sharpchen opened this issue Jun 16, 2023 · 7 comments
Assignees
Labels
area-test Test discovery, execution, debugging bug Something isn't working
Milestone

Comments

@sharpchen
Copy link

Describe the Issue

No output recorded after unit testing.

Steps To Reproduce

  1. I'm using xUnit.
  2. example code
using Xunit;
using Xunit.Abstractions;

interface IAdapteeCannotImpl
{
    string DoWork();
}
sealed class Adaptee
{
    public string DoSpecialWork() =>
        $"Hello from {this.GetType().Name}!";
}
class Adapter : IAdapteeCannotImpl
{
    private readonly Adaptee _adaptee = new();
    public string DoWork() => _adaptee.DoSpecialWork();
}
static class ExistingImpl
{
    public static string DoWorkWith(IAdapteeCannotImpl obj) => obj?.DoWork()!;
}

public class AdapterTest
{
    private readonly ITestOutputHelper? _helper;
    public AdapterTest(ITestOutputHelper testOutputHelper) => _helper = testOutputHelper;

    [Fact]
    public void Test()
    {
        Adapter adapter = new();
        _helper!.WriteLine(ExistingImpl.DoWorkWith(adapter));
    }
}
  1. Run the test, no output recorded.
    image

Expected Behavior

This test works fine in Visual Studio.

Environment Information

@sharpchen sharpchen added the bug Something isn't working label Jun 16, 2023
@microsoft-issue-labeler microsoft-issue-labeler bot added the area-project Project load, Solution Explorer label Jun 16, 2023
@timheuer timheuer added area-test Test discovery, execution, debugging and removed area-project Project load, Solution Explorer labels Jun 16, 2023
@NebulousPsychology
Copy link

Seconded. my attempts to view output text from ITestOutputHelper have so far led me to three or four config-ways including .runsettings, and launch/task shenanigans. None are quite as basic as I'd hoped, and some are ignored or conflict with others. Simplest was a competing test explorer extension that allows direct access to the arguments of dotnet test.

@lucky51
Copy link

lucky51 commented Jan 24, 2024

Is there any news about this?

@yedajiang44
Copy link

No progress or reply

@peterwald peterwald removed this from the Feb2024 milestone Mar 6, 2024
Copy link

github-actions bot commented Apr 4, 2024

This issue has been marked as stale after 14 days of inactivity.@[@@], could you please take a look?

@NebulousPsychology
Copy link

I have observed that output is currently logged and viewable when a test fails, but I'm still interested in an option to force output that doesn't alter the expressed logic of the test

@ocallesp
Copy link
Member

ocallesp commented Apr 4, 2024

#989 should fix this issue

@peterwald peterwald added this to the June2024 milestone Apr 30, 2024
@peterwald
Copy link
Member

Check the C# Dev Kit - Test Explorer output as xUnit may log it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-test Test discovery, execution, debugging bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants