SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.24k stars 754 forks source link

LivinDoc Testfailure-Messages are not line-wrapped correctly #2528

Open Jazzman82 opened 2 years ago

Jazzman82 commented 2 years ago

SpecFlow Version

3.9.40 (Specflow), 3.9.57 (LivingDocPlugin)

Which test runner are you using?

NUnit

Test Runner Version Number

Rider Testrunner (2021.3 EAP 10), dotnet test (net6)

.NET Implementation

.NET 5.0

Project Format of the SpecFlow project

Sdk-style project format

.feature.cs files are generated using

SpecFlow.Tools.MsBuild.Generation NuGet package

Test Execution Method

Command line – PLEASE SPECIFY THE FULL COMMAND LINE

SpecFlow Section in app.config or content of specflow.json

No response

Issue Description

Commandline to execute tests: dotnet test

Commandline to generate LivingDoc:

livingdoc test-assembly DataGatewayServiceTests.dll -t TestExecution.json

Steps to Reproduce

Create a test which fails with a multiline error-message (e.g. some FluentAssertions-Output on collection-comparison)

This produces output similar to this: ` -> error: Expected property actualTree!.Variables[0].ChildSymbols to be a collection with 2 item(s), but found an empty collection. Expected property actualTree!.Variables[1].ChildSymbols to be a collection with 2 item(s), but found an empty collection.

With configuration:

In the LivingDoc.html, the message is displayed like this: image

It would be nice, if the message respects the line breaks like the output on console.

Link to Repro Project

No response

BL323 commented 2 years ago

This could be achieved by adding white-space: pre-wrap CSS property to the error-content class.

image

Although I think the LivingDoc generator may be closed source? So there might not be an opportunity to implement a fix unless a someone with access can add the property.

SabotageAndi commented 2 years ago

Awesome @BL323! I will try to get this small fix into LivingDoc. Warning: It could take a while, next release is planned when we release SpecFlow 3.10.

BL323 commented 2 years ago

Sounds good, thanks!