xunit / visualstudio.xunit

VSTest runner for xUnit.net (for Visual Studio Test Explorer and dotnet test)
https://xunit.net/
Other
144 stars 81 forks source link

Cannot filter through FullyQualifiedName or DisplayName while discovering tests in test assembly #370

Closed ZCao-96 closed 1 year ago

ZCao-96 commented 1 year ago

Background

Currently, we are developing a feature to get test cases count from a specific test assembly in vstest.console and we want do it with test case filter to make the number more accurate. We happily found that, thanks to @nohwnd's commit 9c651a8, we can filter test cases during test discovery.

However, we find out that we cannot filter test assemlies based on xunit through FullyQualifiedName or DisplayName during test discovery. In the mean time, we also find out that we can filter test assemlies based on xunit through FullyQualifiedName or DisplayName while running the test assembly.

Proposed Feature

To filter test cases through FullyQualifiedName or DisplayName during test discovery, we navigate to this source code repo and we think that the variable isDiscovery in the file TestCaseFilter.cs is blocking this goal. I am wondering if we could remove this isDiscovery variable since it is its only reference.

Now

Every filter during test discovery should only base on Traits.

Future

Every filter during test discovery can base on one of these ways: Traits, FullyQualifiedName or DisplayName.

Action needed

Remove the isDiscovery variable in the file TestCaseFilter.cs.

Maybe @nohwnd would know more context regarding this feature.

Could anyone help me with this? Thanks!

nohwnd commented 1 year ago

Could you send a PR of the change you want to make and add tests that show the behavior you'd like to see, please?

ZCao-96 commented 1 year ago

Hey @nohwnd , thank you for your response. I have made some changes in the code but I was blocked when I tried to push the code as below. Is it due to some settings on pull request in this repo? Any ideas? Much appreciated! image

bradwilson commented 1 year ago

@ZCao-96 You'll need to make a fork of this repo into your personal account, push the changes there, and initiate the PR from that fork back to this repo. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork

bradwilson commented 1 year ago

Merged in #380

ZCao-96 commented 1 year ago

Much appreciated for @bradwilson 's quick response! Thank you so much! This change will definitely unblock the feature we are working on. I got one last small question, when is this change going to be rolled out and available in Production/WorldWide? Any ideas?

bradwilson commented 1 year ago

@ZCao-96 I'll put out another prerelease build to NuGet next week. Not sure on a final release date yet.

ZCao-96 commented 1 year ago

@bradwilson Thanks! That would be enough for me.

bradwilson commented 1 year ago

@ZCao-96 https://www.nuget.org/packages/xunit.runner.visualstudio/2.5.1-pre.10

ZCao-96 commented 1 year ago

@bradwilson Great! Thanks! Looking forward to the official version~