Offline support is one of the most complex features not only to implement but also to test. In this sample project, I'll show you how to disable the network on iOS Simulator from XCTest. Strap in, it can open up a whole new world for your automated test cases.
-
Install dependencies
npm install
-
Run the server
node server.js &
-
Run the sample test
xcodebuild test \ -destination 'platform=iOS Simulator,name=iPhone 14' \ -scheme Sample | xcpretty