-
Notifications
You must be signed in to change notification settings - Fork 260
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
Extensible Filters + AggregateFilter #4200
base: main
Are you sure you want to change the base?
Conversation
@Evangelink Hope you don't mind me having a go at tackling a couple of issues that have been sitting around for months?
|
… feature/extensible-filters
Same happening with integration tests
Why does it reference packages instead of the local project's code? |
@Evangelink @nohwnd @MarcoRossignoli Providing you were okay with implementing this, how would I go about being unblocked due to private/internal code that I can't edit? |
@thomhurst I wasn't able to play a little with the PR but although I like the concept of the aggregate filter, I don't think that the extensibility as you are doing it is the right way forward as it would allow users to register any kind of filter including filters that are not handled by the framework. As of now, the filters have to be specifically supported by the platform or the framework. |
Hmm that's a good point. The registration code is going to have to be surfaced publicly though in order for frameworks to register it. Might be that filters work in conjunction with capabilities? So filters are only considered active/available if the framework has a capability for it? Kinda like the trx extension. That way we know a framework can handle that filter. |
Another alternative is the filter knows how to perform the logic itself, so that users could actually add filters on the fly without specific support from the framework. This actually makes it freely extensible by the end-user rather than the framework author. E.g.
|
@Evangelink did you have any opinions? I think the filter defining its own logic means users could make their own filters. Way more extensible then |
@Evangelink @nohwnd @MarcoRossignoli @Youssef1313 Here's my latest idea on filtering. Each implementation implements its own This means all frameworks need to do is call: Of course, they still could override the behaviour by doing what they do currently - Casting to the concrete type and implementing the filtering themselves, but I don't envision a lot of scenarios where you'd want to change the logic. This also makes filtering more consistent between frameworks as they can all use centralised logic instead of recreating it themselves, with the risk of introducing bugs. This also means users could create their own filters and register them, and they'd automatically flow through as the ITestExecutionFilter, or inside the AggregateFilter, and the filtering will work with their newly introduced logic without the framework even having to know about the specific type/logic. Keen to know your thoughts. I think this works nicely with the Open/Closed principle - Closed for modification but highly open to extensibility 😄 |
WIP.
Fixes #3530
Fixes #3590
Changes:
IsAvailable
property (I dunno what to name this? IsAvailable? IsActive?) to tell the framework whether it has been requested as a filter for this test runITestExecutionFilter[]
array insideAggregateFilter
Framework authors can now also create their own filters and register them.
ITestExecutionFilter
.TestApplicationBuilder.TestHost.RegisterTestExecutionFilter(...)