Skip to content

Commit

Permalink
Add documentation for colored output
Browse files Browse the repository at this point in the history
  • Loading branch information
Socolin committed Jun 15, 2022
1 parent 0361935 commit 5b382a2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
27 changes: 27 additions & 0 deletions docs/Execution/Color-Output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Color Test Result Output

## Configuration

To enable the colorization of the test result output, you can turn the `trace.coloredOutput` to true in the [configuration](../Installation/Configuration.md)

The color will only be visible in supported place, like in Rider test runner or in the console when running test using `dotnet test`.

You can turn off the color by setting `NO_COLOR=1` environment variable. This can be useful when you run the tests on a build server that does not support colors.

## Customization

You can customize the colors by configuring a Hook and injecting `IColorOutputTheme` like in the following example.

```csharp
[Binding]
public class Hooks
{
[BeforeTestRun]
public static void ConfigureColor(IColorOutputTheme colorOutputTheme)
{
colorOutputTheme.Keyword = AnsiColor.Reset;
colorOutputTheme.Error = AnsiColor.Composite(AnsiColor.Bold, AnsiColor.Foreground(TerminalRgbColor.FromHex("FF8EF3")));
colorOutputTheme.Done = AnsiColor.Foreground(TerminalRgbColor.FromHex("3A86FF"));
}
}
```
13 changes: 7 additions & 6 deletions docs/Installation/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,13 @@ Use this section to specify various test execution options.

Use this section to determine the SpecFlow trace output.

| Attribute | Value | Description |
| --------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| traceSuccessfulSteps | true/false | Determines whether SpecFlow should trace successful step binding executions. <br/>**Default:** true |
| traceTimings | true/false | Determines whether SpecFlow should trace execution time of the binding methods (only if the execution time is longer than the minTracedDuration value).<br/>**Default:** false |
| minTracedDuration | TimeSpan (0:0:0.1) | Specifies a threshold for tracing the binding execution times.<br/>**Default:** 0:0:0.1 (100 ms) |
| stepDefinitionSkeletonStyle | RegexAttribute/MethodNameUnderscores/MethodNamePascalCase/MethodNameRegex | Specifies the default [step definition style](../Bindings/Step-Definitions.html#step-matching-styles-rules).<br/>**Default:** RegexAttribute |
| Attribute | Value | Description |
|-----------------------------|---------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| traceSuccessfulSteps | true/false | Determines whether SpecFlow should trace successful step binding executions. <br/>**Default:** true |
| traceTimings | true/false | Determines whether SpecFlow should trace execution time of the binding methods (only if the execution time is longer than the minTracedDuration value).<br/>**Default:** false |
| minTracedDuration | TimeSpan (0:0:0.1) | Specifies a threshold for tracing the binding execution times.<br/>**Default:** 0:0:0.1 (100 ms) |
| stepDefinitionSkeletonStyle | RegexAttribute/MethodNameUnderscores/MethodNamePascalCase/MethodNameRegex | Specifies the default [step definition style](../Bindings/Step-Definitions.html#step-matching-styles-rules).<br/>**Default:** RegexAttribute |
| coloredOutput | true/false | Determine whether SpecFlow should color the test result output. See [Color Test Result Output](../Execution/Color-Output.md) for more details<br/>**Default:** false<br/>When this setting is enable you can disable color, for example to run it on a build server that does not support colors, with the environment variable `NO_COLOR=1` |

### `stepAssemblies`

Expand Down

0 comments on commit 5b382a2

Please sign in to comment.