-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter during discovery #205
Conversation
@clairernovotny This is a draft implementation to solve microsoft/vstest#2273. I implemented this in a way that has the smallest impact on your adapter but it has some trade-offs. I would like to know your opinion before I commit to implement this 100%. At the moment the functionality works, but there are few things that I don't like:
How the changes look to you? |
cc @bradwilson |
This looks okay to me.
I suspect this isn't worth rearranging the order of things to solve, so I'd leave it to be done later if it's discovered that we really need it. |
I'm not 100% sure we should be trying to do validation during discovery anyway. You really don't want to interrupt discovery if you can help it, from a usability standpoint. Frankly, the fact that the discovered list suddenly becomes empty should be a pretty good sign you have a bad trait filter. 😉 |
@@ -44,7 +56,7 @@ public bool MatchTestCase(TestCase testCase) | |||
public object PropertyProvider(TestCase testCase, string name) | |||
{ | |||
// Traits filtering | |||
if (knownTraits.Contains(name)) | |||
if (isDiscovery || knownTraits.Contains(name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bradwilson I probably did not explain myself well with the trait filter. What I meant is that in the line above the filter checks for known traits. If this hashset is empty it will not consider any traits. I can either skip the Contains check as I do now, and make the filtering a bit slower, OR add to the known traits all traits from the current batch, before processing filtering that batch.
The latter solution seems to be optimal, but I would rather add to the known traits via method, than by passing a live reference to a hashset, because that seems more obvious and less fragile. Do you agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't obsess too much with optimization like this unless it's demonstrably poor. I usually rely on the .NET or Roslyn team to come back and tell me where they've hit performance issues. 😂
@clairernovotny is it possible for you to release a new version with this change, anytime soon? thanks |
Add filtering during discovery to be able to list only tests that pass the given filter.