We are investigating a supported architecture for running existing app-hosted XCTest unit and integration tests in iOS Simulator under external process supervision.
Our environment is Xcode 27.2, targeting ARM64 iOS Simulator. The tests use SwiftData, CoreData and SQLite with synthetic, test-owned databases.
We need to run selected tests serially in isolated processes, monitor their resource usage, and verify that all test-related processes have terminated before cleaning up test databases.
Our primary question:
Is there a documented, supported way to establish external process supervision before the actual iOS Simulator XCTest host executes any application or test-bundle code?
In particular, we are looking for guidance on the following:
- Pre-execution control: Can the actual XCTest host be launched suspended and released only after an external supervisor has established monitoring? We need coverage of application and test-bundle initialization, not merely a callback before the first test method.
- Process identity: Is there a supported mechanism to identify and monitor the actual host process using an OS-verifiable identity that remains reliable despite PID reuse?
- Process termination: Is there a supported way to identify and terminate only the processes belonging to a specific test run, including detached or reparented children, without affecting unrelated Simulator processes?
- XCTest integration: Can this be achieved while preserving normal XCTest discovery, setup/teardown, asynchronous tests and genuine .xcresult reporting?
We have investigated public XCTest APIs, standard xcodebuild workflows and macOS process-control mechanisms.
We also successfully compiled and linked a separate ARM64 Simulator executable against our unchanged application debug dylib and XCTest dependencies. However, this was strictly a compile/link experiment: the executable was never launched, and we have not established that a custom XCTest host is supported.
We are not seeking private APIs or undocumented CoreSimulator behavior.
If this level of supervision is not supported, what is Apple’s recommended documented alternative?
In particular, does the standard Xcode-managed XCTest workflow provide any documented guarantees regarding host process identity, lifecycle containment and complete termination of test-related processes?
References to official documentation or supported examples would be greatly appreciated.