Hi Vlad,
> - Google Test introduces the new event. The proposed signature is
> void OnTestListAvailable(TestList test_cases, bool* continue);
> - The event is fired after all the tests are registered and marked as
> should run/should not run.
> - The event listeners have chance to adjust the set of tests to run.
> There are two alternatives for doing this:
> 1. Listeners modify GTEST_FLAG(filter). In this case the the list of
> test cases can be obtained via the UnitTest class.
> 2. Listeners set the should_run flag on individual TestInfo objects.
> This will require us to somehow pass non-const TestInfos into
> the event. For
> example, we can introduce TestList that will give write access
> to TestInfos
> contained in it.
> - After the listeners have finished, Google Test does all
> processing necessary to adjust the set of tests to run.
> - Listeners will have an option of setting the parameter continue to
> false to prevent Google Test from actually running the tests.
The *continue in this case would not be much different from exit(),
except - I guess - it would let other listeners get called (which is
not a bad idea, anyway).
But the point is how to modify the test set.
Maybe an event fired before the test is added to the list would help:
OnAddToTestList(TestInfo ..., bool *shouldAdd)
In this scenario I could:
1) build a list of all the tests by listening to AddToTestList(... ,
true)
2) show the list to the user, let him select what to run
3) run the tests listening to AddToTestList again, but this time
*shouldAdd = myWhatShouldRunList.Contains(testinfo)
>
> I would like everyone interested comment on the proposal. Maybe someone has
> concerns about bad interactions with disabled tests, or with sharding. Maybe
> someone has a better solution?
thanks,
P