Skip to content

Commit

Permalink
Merge pull request #1235 from Evangelink/filter-test-explorer
Browse files Browse the repository at this point in the history
Filter test explorer
  • Loading branch information
OsirisTerje authored Feb 4, 2025
2 parents d4203b6 + 1301912 commit 4bac1f5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/NUnitTestAdapter/NUnit3TestExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public sealed class NUnit3TestExecutor : NUnitTestAdapter, ITestExecutor, IDispo
IExecutionContext
{
#region Properties
private bool IsMTP { get; }

private RunType RunType { get; set; }

Expand All @@ -87,6 +88,16 @@ public sealed class NUnit3TestExecutor : NUnitTestAdapter, ITestExecutor, IDispo

#endregion

public NUnit3TestExecutor()
: this(false)
{
}

internal NUnit3TestExecutor(bool isMTP)
{
IsMTP = isMTP;
}

#region ITestExecutor Implementation

/// <summary>
Expand Down Expand Up @@ -125,6 +136,10 @@ public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrame
var vsTestFilter = VsTestFilterFactory.CreateVsTestFilter(Settings, runContext);
filter = builder.ConvertVsTestFilterToNUnitFilter(vsTestFilter);
}
else if (RunType == RunType.Ide && IsMTP)
{
filter = builder.ConvertVsTestFilterToNUnitFilter(VsTestFilter);
}

filter ??= builder.FilterByWhere(Settings.Where);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected override Task SynchronizedDiscoverTestsAsync(VSTestDiscoverTestExecuti
protected override Task SynchronizedRunTestsAsync(VSTestRunTestExecutionRequest request, IMessageBus messageBus,
CancellationToken cancellationToken)
{
ITestExecutor executor = new NUnit3TestExecutor();
ITestExecutor executor = new NUnit3TestExecutor(isMTP: true);
using (cancellationToken.Register(executor.Cancel))
{
executor.RunTests(request.AssemblyPaths, request.RunContext, request.FrameworkHandle);
Expand Down

0 comments on commit 4bac1f5

Please sign in to comment.