SpecFlow icon indicating copy to clipboard operation
SpecFlow copied to clipboard

LivinDoc Testfailure-Messages are not line-wrapped correctly

Open Jazzman82 opened this issue 4 years ago • 3 comments

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:

  • Use declared types and members
  • Compare enums by value
  • Compare tuples by their properties
  • Compare anonymous types by their properties
  • Compare records by their members
  • Include all non-private properties
  • Include all non-private fields
  • Exclude member TypeName
  • Exclude member Attributes
  • Match member by name (or throw)
  • Be strict about the order of items in byte arrays
  • Without automatic conversion. `

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

Jazzman82 avatar Dec 02 '21 08:12 Jazzman82

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.

BL323 avatar Apr 17 '22 14:04 BL323

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.

SabotageAndi avatar Apr 20 '22 14:04 SabotageAndi

Sounds good, thanks!

BL323 avatar Apr 20 '22 19:04 BL323