This is a sample project to test out the FBSimulatorControl library. It contains an iOS app with a single unit test (see: SingleViewApp) and a Mac app (see: DriveSimulators) which uses the FBSimulatorControl library to create an iOS simulator for the test run, execute the test and after the test execution has been finished, tear down the simulator.
The unit test is not a real test, it just keeps occupied the simulator for 5 seconds.
After cloning the repository run run.sh. This should compile everything, and after it should run all of the termination notification tests which I can think of.
These are the following:
- Listening to the
FBSimulatorSessionApplicationProcessDidTerminateNotification
notification. - Periodically checking the
session.state.runningApplications
list to see whether the app is still there - Getting the process ID with
[session.state processForApplication:simulatorApplication].processIdentifier
and setting up a termination listener with[FBDispatchSourceNotifier processTerminationNotifierForProcessIdentifier:]
- Periodically launching
ps
with the process ID to see whether the process is there (this works).
All of these can be checked by invoking the app:
build/Mac/DriveSimulator `pwd`/build/iOS a_number_from_the_list_above