diff --git a/client/ios/A2UI-ExampleUITests/A2UI_ExampleUITests.swift b/client/ios/A2UI-ExampleUITests/A2UI_ExampleUITests.swift index 92b0295..c790009 100644 --- a/client/ios/A2UI-ExampleUITests/A2UI_ExampleUITests.swift +++ b/client/ios/A2UI-ExampleUITests/A2UI_ExampleUITests.swift @@ -14,6 +14,7 @@ // limitations under the License. // +import Foundation import XCTest /// UI test suite for the A2UI iOS sample application. @@ -23,6 +24,15 @@ final class A2UIExampleUITests: XCTestCase { override func setUpWithError() throws { continueAfterFailure = false + // XCUIApplication runs in a separate process and does not inherit the test + // runner's environment. Forward LLVM_PROFILE_FILE with continuous sync (%c) + // so coverage counters are persisted even when XCTest terminates the app. + if let profileFile = ProcessInfo.processInfo.environment["LLVM_PROFILE_FILE"], + !profileFile.isEmpty + { + app.launchEnvironment["LLVM_PROFILE_FILE"] = + profileFile.contains("%c") ? profileFile : "\(profileFile)%c" + } } override func tearDownWithError() throws { @@ -31,6 +41,7 @@ final class A2UIExampleUITests: XCTestCase { if XCUIDevice.shared.orientation != .portrait { XCUIDevice.shared.orientation = .portrait } + app.terminate() } // =========================================================================