Getting iOS Simulator UDID from test

Alexey Alter-Pesotskiy
testableapple
Published in
Nov 12, 2022

This Note originally published on my Personal Blog here. Read original note so that you won’t miss any content.

Right off the boat 🤿

import XCTest

class SampleTest: XCTestCase {

func testSimulatorUDID() {
let env = ProcessInfo.processInfo.environment
let udid = env["SIMULATOR_UDID"] ?? ""
XCTAssertNotEqual(udid, "")
}
}

1. Open an Xcode project

2. Create a test file

3. Fill it with the code above

4. Run it on any iOS Simulator

5. Enjoy 🤠

--

--