-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathExampleSteps.cs
59 lines (52 loc) · 1.31 KB
/
ExampleSteps.cs
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Threading.Tasks;
using Allure.XUnit;
using Allure.Xunit.Attributes;
using Xunit;
namespace Allure.Xunit.Examples;
public class ExampleSteps : IAsyncLifetime
{
public Task InitializeAsync()
{
using (new AllureBefore("Initialization"))
{
using (new AllureBefore("Nested"))
{
return Task.CompletedTask;
}
}
}
public Task DisposeAsync()
{
using var _ = new AllureAfter("Cleanup");
return Task.CompletedTask;
}
[AllureXunit]
public async Task TestParameters()
{
WriteHello(42, 4242, "secret");
await AddAttachment();
}
[AllureXunit]
public void TestFail()
{
using (new AllureStep("Test Fail"))
{
using (new AllureStep("Nested"))
{
throw new Exception();
}
}
}
private static void WriteHello(int parameter, int renameMe, string password)
{
using (new AllureStep("Write Hello").SetParameter(parameter).SetParameter("value", renameMe))
{
AllureMessageBus.TestOutputHelper.Value.WriteLine("Hello from Step");
}
}
private static async Task AddAttachment()
{
await AllureAttachments.Text("large json", "{}");
}
}