I am writing unit tests for my Swift application and I would like to delete the app in between each test case for certain suites. I already have a script action set up that uninstalls the app before the whole suite runs. But I have not found a way to be able to delete the app off the simulator in between each test invocation. Is there a way to do this?
What I want is:
import XCTest
@testable import My_App
class MyTests: XCTestCase {
override func setUpWithError throws () {
magic("xcrun simctl uninstall booted ${PRODUCT_BUNDLE_IDENTIFIER}")
}
func testTheThings() {
// test runs with a completely fresh slate...
}
}
Please note that this is unit testing and not UI testing - so I don't think I can have the test delete the app from the Springboard, which is what I otherwise do in my UI tests to give each test a clean slate.