Skip to content

Add Filter.Source integration tests in Microsoft.TestPlatform.Library.IntegrationTests#15652

Merged
Youssef1313 merged 6 commits intodev/ygerges/filter-source-pkgfrom
copilot/add-integration-test-source-filter
Apr 10, 2026
Merged

Add Filter.Source integration tests in Microsoft.TestPlatform.Library.IntegrationTests#15652
Youssef1313 merged 6 commits intodev/ygerges/filter-source-pkgfrom
copilot/add-integration-test-source-filter

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 10, 2026

Summary

Adds proper end-to-end integration tests for the Microsoft.TestPlatform.Filter.Source NuGet package to Microsoft.TestPlatform.Library.IntegrationTests.

The approach uses a dedicated test asset project (FilterSourcePackageConsumerTests) that references the locally-built package as a NuGet dependency. Because the package is source-only (contentFiles), the filter source files are compiled into the consumer assembly as internal sealed types — exactly as an end-user would consume the package. The integration tests then run that test asset through vstest.console to verify the package works end-to-end.

The existing Microsoft.TestPlatform.Filter.Source.UnitTests project continues to test the source-only-package (non-IS_VSTEST_REPO) API by directly linking the source files.

New test asset: FilterSourcePackageConsumerTests

Located in test/TestAssets/FilterSourcePackageConsumerTests/. References Microsoft.TestPlatform.Filter.Source at $(PackageVersion) (the locally-built package). Contains 14 tests across two classes that exercise the embedded filter logic:

FilterExpressionWrapperPackageTests (7 tests)

  • Evaluate returns true/false for matching/non-matching filter
  • Evaluate returns false when filter has a parse error
  • Evaluate supports AND and OR operators
  • ValidForProperties returns null for supported properties
  • ValidForProperties returns unsupported property names

TestCaseFilterExpressionPackageTests (7 tests)

  • MatchTestCase returns true/false for matching/non-matching filter
  • MatchTestCase returns false when filter has a parse error
  • MatchTestCase supports OR operator
  • TestCaseFilterValue returns the original filter string
  • ValidForProperties returns null for supported properties
  • ValidForProperties returns unsupported property names

Integration tests in FilterSourceIntegrationTests.cs

Extends AcceptanceTestBase and runs FilterSourcePackageConsumerTests.dll through vstest.console:

  • FilterSourcePackage_AllTestsPassOnNetCore — verifies all 14 tests pass on .NET Core runners
  • FilterSourcePackage_AllTestsPassOnNetFramework — verifies all 14 tests pass on .NET Framework runners
  • FilterSourcePackage_FilterExpressionWrapperTestsCanBeFilteredByClassName — verifies vstest-level class-name filtering selects the 7 wrapper tests
  • FilterSourcePackage_TestCaseFilterExpressionTestsCanBeFilteredByClassName — verifies vstest-level class-name filtering selects the 7 expression tests

Testing

All tests are verified to build with 0 warnings and 0 errors against the locally-built Microsoft.TestPlatform.Filter.Source.18.7.0-dev.nupkg.

Copilot AI and others added 2 commits April 10, 2026 11:31
Agent-Logs-Url: https://github.com/microsoft/vstest/sessions/cd54345b-ac28-4df2-a11c-bf97609df345

Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Revert the file mode change here..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — reverted in 57f3616.

/// source-only-package (non-IS_VSTEST_REPO) surface area.
/// </summary>
[TestClass]
public class FilterExpressionWrapperIntegrationTests
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot All the tests look wrong. They are unit test on their current form. They should be integration tests. So there should be test assets that actually reference the package built locally.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced the unit-test-style file with proper integration tests in 3889cde.

The new FilterSourcePackageConsumerTests test asset (in test/TestAssets/) references the locally-built Microsoft.TestPlatform.Filter.Source NuGet package. Since it's a source-only package, the filter source files are embedded as contentFiles and compiled as internal sealed types into the consumer assembly — exactly as an end-user would consume it.

FilterSourceIntegrationTests.cs now extends AcceptanceTestBase and runs those 14 tests through vstest.console (both .NET Core and .NET Framework runners), verifying the package works end-to-end.

Agent-Logs-Url: https://github.com/microsoft/vstest/sessions/bd76cc82-b18d-4caa-949e-331115ede2e7

Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Copilot AI and others added 2 commits April 10, 2026 12:18
…terSourcePackageConsumerTests test asset

Agent-Logs-Url: https://github.com/microsoft/vstest/sessions/0622e862-cf7d-4c75-a624-3ebe024133b3

Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
public class FilterSourceIntegrationTests : AcceptanceTestBase
{
[TestMethod]
[NetCoreTargetFrameworkDataSource]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nohwnd What should we use here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

depends on where you want to test, this will run on .net testhost, under .net framework and .net runner. if there are any compiler conditions you probably want the opposite, where you run .net and .net framework testhost and just .net runner runner?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah looks like this test simply runs the child project for isolation and we validate that all the tests there pass. We need to run this for both .net and .netfx, so the pattern described below.

All other tests here seems useless because they either re-run the same, or test that we can filter tests externally, but that is not the point here.

}

[TestMethod]
[NetFullTargetFrameworkDataSource]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the same as above. if the goal is to run on both tfms for testhost then do

[NetFullTargetFrameworkDataSource(useDesktopRunner: false)]
[NetCoreTargetFrameworkDataSource(useDesktopRunner: false)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and mrege the tests

@Youssef1313 Youssef1313 marked this pull request as ready for review April 10, 2026 12:35
@Youssef1313 Youssef1313 merged commit 42721e3 into dev/ygerges/filter-source-pkg Apr 10, 2026
2 checks passed
@Youssef1313 Youssef1313 deleted the copilot/add-integration-test-source-filter branch April 10, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants