# New \`discover\_tests\` command

**URL:** https://discourse.cmake.org/t/new-discover-tests-command/15533
**Category:** Development
**Created:** [February 27, 2026, 4:56pm UTC](https://discourse.cmake.org/t/new-discover-tests-command/15533 "2026-02-27T16:56:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![purpleKarrot](https://discourse.cmake.org/user_avatar/discourse.cmake.org/purplekarrot/32/4821_2.png) [@purpleKarrot](https://discourse.cmake.org/u/purpleKarrot)
#### Post date: [February 27, 2026, 4:56pm UTC](https://discourse.cmake.org/t/new-discover-tests-command/15533/1 "2026-02-27T16:56:01Z")

</div>

I would like to get more eyes on my [prototype](https://gitlab.kitware.com/purpleKarrot/cmake/-/tree/discover-tests) for a new `discover_tests()` command.

The full signature is as follows:

```cmake
discover_tests(COMMAND <command> [<arg>...]
  [CONFIGURATIONS <config>...]
  DISCOVERY_ARGS <arg>...
  DISCOVERY_MATCH <regex>
  [DISCOVERY_TIMEOUT <seconds>]
  TEST_NAME <replacement>
  TEST_ARGS <replacement>...
  [PROPERTIES <key> <replacement> [<key> <replacement>]...]
  [WORKING_DIRECTORY <dir>]
  [COMMAND_EXPAND_LISTS]
)

```

More documentation is in my branch. Here is a repository with examples for various testing frameworks: [GitHub - purpleKarrot/cmake-discover-tests](https://github.com/purpleKarrot/cmake-discover-tests)

I would like to have more discussion about the design before I proceed with tests and better error handling.

---

<div class="post-metadata">

### Author: ![benthevining](https://discourse.cmake.org/user_avatar/discourse.cmake.org/benthevining/32/1924_2.png) [@benthevining](https://discourse.cmake.org/u/benthevining)
#### Post date: [February 27, 2026, 6:49pm UTC](https://discourse.cmake.org/t/new-discover-tests-command/15533/2 "2026-02-27T18:49:31Z")

</div>

I love this idea, it would be quite a useful addition!

---

<div class="post-metadata">

### Author: ![purpleKarrot](https://discourse.cmake.org/user_avatar/discourse.cmake.org/purplekarrot/32/4821_2.png) [@purpleKarrot](https://discourse.cmake.org/u/purpleKarrot)
#### Post date: [February 28, 2026, 6:50am UTC](https://discourse.cmake.org/t/new-discover-tests-command/15533/3 "2026-02-28T06:50:04Z")

</div>

Discussion here: [https://gitlab.kitware.com/cmake/cmake/-/issues/26920](https://gitlab.kitware.com/cmake/cmake/-/issues/26920)
