allure-framework / allure-framework/allure-csharp

xUnit.net: Move ITestOutputHelper messages from status details to attachments

Open
#423 0 comments 0 reactions 0 assignees View on GitHub
task:improvement theme:xunit
Dominant language
C#
Stars
125
Forks
76
Avg merge
1d 2h
Merged PRs (30d)
18

Description

#### I'm submitting a ...
- [ ] bug report
- [x] feature request
- [ ] support request => Please do not submit support request here, see note at the top of this template.

#### What is the current behavior?
Messages logged via ITestOutputHelper are shown as status details in the report. Additionally, messages of failed or broken tests aren't included at all.

#### If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

If we run the following code:

```csharp
using Xunit;
using Xunit.Abstractions;

public class TestOutput
{
readonly ITestOutputHelper logger;

public TestOutput(ITestOutputHelper logger)
{
this.logger = logger;
}

[Fact]
public void TrueFactWithOutputMessage()
{
this.logger.WriteLine("This message is shown in the status details area.");
}

[Fact]
public void FalseFactWithOutputMessage()
{
this.logger.WriteLine("This message isn't shown.");
Assert.Fail("Failure message");
}
}
```

The following report is generated:

![image](https://github.com/allure-framework/allure-csharp/assets/17935127/b64cc02d-916b-4892-96d9-004652fc7455)
![image](https://github.com/allure-framework/allure-csharp/assets/17935127/15f6f60b-6037-4265-9c72-05bce738f627)

#### What is the expected behavior?

Log messages are collected and included in the report as the test's attachment.

#### What is the motivation / use case for changing the behavior?

This is what users who worked previously with other integrations expect from allure-xunit to begin with.
Using the status details area is also less convenient because there is no way to hide it (only trace could be hidden, but not the message). This becomes an issue as soon as the number of log messages increases.

#### Please tell us about your environment:

- Allure version: 2.23.1
- Test framework: xUnit.net@2.5.3
- Allure adaptor: Allure.XUnit@2.10.0

Contributor guide

Open the contributing guide

Research direction

Start by tracing how Allure.XUnit handles ITestOutputHelper messages for the two-test example in the issue. Verify the current status-details behavior, then confirm that output from passing and failing tests is represented as an attachment and is absent from status details.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.