-
Notifications
You must be signed in to change notification settings - Fork 31
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
Apply test filter for test run #1172
base: main
Are you sure you want to change the base?
Conversation
All kind of test runs finally execute the method RunTests(TestRunSpecification runSpec) in class This central change first checks if the NUnit DisplayFormat is used and if any visual TestFilter is active. Only in that case we call a new method TestFilter.MakeVisibleIdFilter(runSpec.SelectedTests) to apply the filter. |
I needed to extend the filter implementation to determine if any filter is currently set. Therefore I added a new property |
The actual filter is created in class |
I guess that the changes in class I solved this issue now, by retrieving all the corresponding TestNodes for the ResultNodes and passing the TestNodes to the RunTests(...) method. This solution works fine. |
I have the impression that it's possible to refactor some part in class |
I added several unit tests for the new implementation. In this process I changed some of the filter classes from internal to public - just to access them from the |
This PR is another contribution to the test filter functionality (#1148, #1147 and #1161).
It contains my proposal to apply the active test filter to a test run. So far all test filter contributions affects only the visual TreeView by showing/hiding tree nodes. But a test run didn't consider the test filter so far.
In general a test run should consider the active test filter. For example, if a test filter only displays a single test, then only this single test should be executed, even if you start 'Run all tests'.
I tested this proposal successfully using these different test run types:
Unfortunately this PR contains a dozen of changed files. But actually I was really happy that I managed to solve it by one central adaptation. Although the result of changed files might indicate that it wasn't that central...
I hope that it's still possible to review the changes.
The general idea of this proposal is to use a TestId-Filter which contains all IDs of the visible TestNodes. The IsVisible property of a TestNode is set by the filtering - so the set of visible TestNodes represents exactly the result of the filtering.
I'll comment on the indivdual changes in the next comments.