Skip to content

Commit a76ac7f

Browse files
committed
xunit fact attribute
1 parent 6fc009d commit a76ac7f

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/QAToolKit.Engine.Bombardier.Test/BombardierTestsRunnerTests.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ public BombardierTestsRunnerTests(ITestOutputHelper testOutputHelper)
2323
_logger = loggerFactory.CreateLogger<BombardierTestsRunnerTests>();
2424
}
2525

26-
#if DEBUG
27-
[Fact]
28-
#endif
26+
[IgnoreOnGithubFact]
2927
public async Task BombardierGetTestWithOptionsTest_Successfull()
3028
{
3129

@@ -69,9 +67,7 @@ public async Task BombardierGetTestWithOptionsTest_Successfull()
6967
Assert.True(bombardierResults.FirstOrDefault().TestStop.Subtract(bombardierResults.FirstOrDefault().TestStart).TotalSeconds == bombardierResults.FirstOrDefault().Duration);
7068
}
7169

72-
#if DEBUG
73-
[Fact]
74-
#endif
70+
[IgnoreOnGithubFact]
7571
public async Task BombardierPostTestWithOptionsTest_Successfull()
7672
{
7773

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using Xunit;
3+
4+
public sealed class IgnoreOnGithubFact : FactAttribute
5+
{
6+
public IgnoreOnGithubFact()
7+
{
8+
if (IsGitHubAction())
9+
{
10+
Skip = "Ignore the test when run in Github agent.";
11+
}
12+
}
13+
14+
private static bool IsGitHubAction()
15+
=> Environment.GetEnvironmentVariable("GITHUB_ACTION") != null;
16+
}

0 commit comments

Comments
 (0)