Discovering Tests for XCTest on Linux and Windows

(Gwen Mittertreiner) #1

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?
5 Likes
(Michael Gottesman) #2

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?

2 Likes
(Michael Gottesman) #3

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