I’m running a test that launch a list of bundleID one by one and check if a specific button exist in the app. My current issue is when one app does not have the button -> test fail, but then the test stops checking the next bundleID.
How do I make the test continue checking the next bundleID?
Here is what I have now
func testLaunchApp() {
let bundles = ["com.App1", "com.App2", "com.App3", "com.App4"]
for bundle in bundles {
XCContext.runActivity(named: "Test launching (bundle)") { activity in
setUp()
testToBeLoop(bundle: bundle)
tearDown()
}
}
}
func testToBeLoop(bundle: String){
let app = XCUIApplication(bundleIdentifier: bundle)
app.launch()
let theButton = app.button["myButton"]
let isVisible = theButton.waitForExistence(timeout: 1)
XCTAssert(isVisible, "Button is not visible)
}
Currently, if “com.App3” failed the Assert, the test will stopped without checking “com.App4” next.
New contributor
SnuwFox is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.