XCTest on macOS - streamline process

Hello,

we use XCTest to run test on our macOS apps. It is good, but it prevents the use of the mac in the meantime, since it actually moves the mouse and perform click, rather than simulate them.

  1. Is there a way to send mouse movements and clicks to the app, rather than actually moving the mouse?

  2. Can I run the test inside a macOS simulator?

  3. How do XCTest work under the hood? I can see the testing framework has access to a very detailed view of what's inside the macOS app, even though we have not done anything special. Is it using something like Apple Script under the hood?

Accepted Reply

Can I run the test inside a macOS simulator?

There is no macOS simulator but you could reasonably use a VM for this.

How do XCTest work under the hood?

I believe you’re talking about the UI testing stuff here, and that mostly works using macOS’s accessibility features. If you poke at your app with Accessibility Inspector, you can see much of the same info.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Replies

Can I run the test inside a macOS simulator?

There is no macOS simulator but you could reasonably use a VM for this.

How do XCTest work under the hood?

I believe you’re talking about the UI testing stuff here, and that mostly works using macOS’s accessibility features. If you poke at your app with Accessibility Inspector, you can see much of the same info.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"