-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create GremlinqTestFramework to filter tests early based on traits. T…
…he SideEffectTestCaseOrderer filtering can go. Only link AssemblyInfo.cs in .Tests projects.
- Loading branch information
1 parent
b0e4519
commit 74487dc
Showing
6 changed files
with
53 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
[assembly: CollectionBehavior(DisableTestParallelization = true)] | ||
using ExRam.Gremlinq.Tests.Infrastructure; | ||
|
||
[assembly: CollectionBehavior(DisableTestParallelization = true)] | ||
[assembly: TestFramework(typeof(GremlinqTestFramework))] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Reflection; | ||
|
||
using Xunit.Sdk; | ||
using Xunit.v3; | ||
|
||
[assembly: CollectionBehavior(DisableTestParallelization = true)] | ||
|
||
namespace ExRam.Gremlinq.Tests.Infrastructure | ||
{ | ||
public sealed class GremlinqTestFramework : XunitTestFramework | ||
{ | ||
private sealed class GremlinqTestFrameworkExecutor : ITestFrameworkExecutor | ||
{ | ||
private readonly ITestFrameworkExecutor _baseExecutor; | ||
|
||
public GremlinqTestFrameworkExecutor(ITestFrameworkExecutor baseExecutor) | ||
{ | ||
_baseExecutor = baseExecutor; | ||
} | ||
|
||
public ValueTask RunTestCases(IReadOnlyCollection<ITestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) => _baseExecutor.RunTestCases( | ||
testCases | ||
.Where(testCase => | ||
{ | ||
if (testCase.Traits.TryGetValue("Category", out var categories) && categories.Contains("IntegrationTest")) | ||
return testCase.Traits.TryGetValue("ValidPlatform", out var validPlatforms) && validPlatforms.Any(validPlatform => OperatingSystem.IsOSPlatform(validPlatform)); | ||
|
||
return true; | ||
}) | ||
.ToArray(), | ||
executionMessageSink, | ||
executionOptions); | ||
} | ||
|
||
public override string TestFrameworkDisplayName => "hallo"; | ||
|
||
protected override ITestFrameworkDiscoverer CreateDiscoverer(Assembly assembly) => base.CreateDiscoverer(assembly); | ||
|
||
protected override ITestFrameworkExecutor CreateExecutor(Assembly assembly) => new GremlinqTestFrameworkExecutor(base.CreateExecutor(assembly)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters