Skip to content

Conversation

@ottmar-zittlau
Copy link

This change addresses item #4408

This changes the behaviour of the test explorer tree view

The following changes are proposed:

  • If tests are added in cmake via add_test and at the same time via gtest_discover_tests it can happen that the tree view doesn't work properly, because test descriptions from gtest_discover_tests are overwritten by those generated by add_test. I think the correct approach would be to only use one of these commands in cmake - but still I thought it would be a good idea to make it work. The fix works by reusing existing test items.

  • Another thing that annoyed me was that the tree structure was changing when a test is run - I tried to capture the behaviour here:
    test_visibility_changes.webm

  • I found out that cmake build is executed when tests are run - and afterwards the tests are refreshed. This refreshing works by removing all test items and re-building the tree structure. This caused all the items in the tree to be initialized in a certain state. I fixed this by keeping track of all the currently active test ids and removing the deleted ones at the end of the refresh-function.

Other Notes/Information

For the second issue I tried to figure out a way to avoid refreshing the tree if nothing has changed.
However, it seems as if this is not trivial. It could be possible to compute and store a hash (or something in this direction) of the json that is produced by cmake and use it as an indicator - let me know if you think it would be worthwhile to explore this direction.

Thanks and best regards
oz

@ottmar-zittlau ottmar-zittlau changed the title Fix/some ctest issues Fix some ctest issues Dec 21, 2025
@ottmar-zittlau
Copy link
Author

@microsoft-github-policy-service agree

@hanniavalera hanniavalera force-pushed the fix/Some-ctest-issues branch from 2d8534a to ce072c9 Compare January 12, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant