Open Socolin opened 2 years ago
@gasparnagy your two cents to this?
I am fine with this.
Looks interesting. We can try in an opt-in fession without too much risk... @Socolin could you please try to make a PR for this so that it is easier to review/test the changes?
Link to Feature Request
No response
Implementation Idea
Hello,
I would like to add some colors in the specflow output, it'll make it simpler and easier to find what step failed when reading the test output. Since Visual Studio does not support it this feature would impact only Rider users and test output on build servers (
dotnet test
)Here a preview of what it can look like
By default this feature would be disabled (so it does not break anything) then people could enable it with the config
trace.coloredOutput
If the color is problematic in some context it's possible to disable it with
NO_COLOR
environment variable (https://no-color.org/).For teams using Rider and VS I would need a bit of help to find a way to detect if the execution is done through VS (I don't have VS so I cannot do test, but maybe there is an environment variables set we can use to detect it, otherwise since Rider allow to provide custom env variable in test runner we could add a
FORCE_COLOR
too, ignoring the configuration)I have a WIP so you can test it already, I'll wait to get some feedback before writting test & co https://github.com/Socolin/SpecFlow/commits/color-output
The colors can be configure by injecting
IColorOutputTheme
so users can decide programatically the colors and adjust if needed (or add Bold / underline etc...) I don't know if we want to allow the color to be configure withspecflow.json
tooWould give an output like
Notes
in
dotnet test
NUnit and xUnit are currently escaping color codes so to test without rider I would recommend to use MSTest for now. I'm working on a fix for NUnit and I opened an issue for xUnit