# Discovering Tests for XCTest on Linux and Windows

**URL:** <https://forums.swift.org/t/discovering-tests-for-xctest-on-linux-and-windows/21971>\
**Category:** Source Tooling\
**Created:** [March 22, 2019, 6:42pm UTC](https://forums.swift.org/t/discovering-tests-for-xctest-on-linux-and-windows/21971 "2019-03-22T18:42:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmittertreiner](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gmittertreiner/32/19651_2.png) [@gmittertreiner](https://forums.swift.org/u/gmittertreiner)\
**Post date:** [March 22, 2019, 6:42pm UTC](https://forums.swift.org/t/discovering-tests-for-xctest-on-linux-and-windows/21971/1 "2019-03-22T18:42:59Z")

</div>

I'd like to enhance the test runner for XCTest on Linux and Windows. Currently you have to include all the tests in a file and it would be very nice to have them discovered as they are with the macOS xcode/objc version. Poking through Mirror/RemoteMirror, there doesn't seem to be a way to enumerate class definitions in Swift, I assume you'd need something like `objc_getClassList(_:_:)` but for Swift. So a few questions:

- Is class/test enumeration possible given the current reflection capabilities?
- If not, what would need to be added?
- And how difficult would it be to implement the things that need to be added?

---

<div class="post-metadata">

**Author:** ![Michael\_Gottesman](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/michael_gottesman/32/280_2.png) [@Michael\_Gottesman](https://forums.swift.org/u/Michael_Gottesman)\
**Post date:** [March 25, 2019, 5:50pm UTC](https://forums.swift.org/t/discovering-tests-for-xctest-on-linux-and-windows/21971/2 "2019-03-25T17:50:44Z")

</div>

I can not speak to the XCTest side of things, but being able to reflect like this is I believe something that would be good for Swift to support.

In fact, @Slava_Pestov, @jrose, @David_Smith and I were talking about similar sort of reflection for auto-registration of swift benchmarks.

@Slava_Pestov do you think the thing you talked about before we work here?

---

<div class="post-metadata">

**Author:** ![Michael\_Gottesman](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/michael_gottesman/32/280_2.png) [@Michael\_Gottesman](https://forums.swift.org/u/Michael_Gottesman)\
**Post date:** [March 25, 2019, 5:51pm UTC](https://forums.swift.org/t/discovering-tests-for-xctest-on-linux-and-windows/21971/3 "2019-03-25T17:51:43Z")

</div>

Specifically, I believe we talked about being able to provide a way to get all classes that conform to a protocol.
