/
xunit.md
45 lines (30 loc) · 1.14 KB
/
xunit.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# xUnit
Reqnroll supports xUnit 2.4 or later.
Documentation for xUnit can be found [here](https://xunit.net/#documentation).
## Needed NuGet Packages
For Reqnroll: [Reqnroll.xUnit](https://www.nuget.org/packages/Reqnroll.xUnit/)
For xUnit: [xUnit](https://www.nuget.org/packages/xunit/)
For Test Discovery & Execution:
- [xunit.runner.visualstudio](https://www.nuget.org/packages/xunit.runner.visualstudio/)
- [Microsoft.NET.Test.Sdk](https://www.nuget.org/packages/Microsoft.NET.Test.Sdk)
## Access ITestOutputHelper
The xUnit ITestOutputHelper is registered in the ScenarioContainer. You can get access to simply via getting it via [Context-Injection](../automation/context-injection.md).
### Example
``` csharp
using System;
using Reqnroll;
[Binding]
public class BindingClass
{
private Xunit.Abstractions.ITestOutputHelper _testOutputHelper;
public BindingClass(Xunit.Abstractions.ITestOutputHelper testOutputHelper)
{
_testOutputHelper = testOutputHelper;
}
[When(@"I do something")]
public void WhenIDoSomething()
{
_testOutputHelper.WriteLine("EB7C1291-2C44-417F-ABB7-A5154843BC7B");
}
}
```