Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode iOS UI tests crash with SIGABRT when multiple test classes exist

I am developing an iOS app using XCUITest methods for testing the interface. I have a basic UI test set up in a first file AppUITests.swift which does let app = XCUIApplication() as member of the XCTestCase subclass, and later does app.launch() in the setUp() method. All is well for tests in this file.

I wanted to create a new test suite for UI tests JUST in the first main "mode" of the application, so I created a new file MainModeUITests.swift and copied the same code over. My plan of course was to test the UI workflows in this mode, but in this new file the application crashes with signal SIGABRT at the line where XCUIApplication() is called.

Currently I am testing on simulator and haven't even gotten to device testing yet. Any ideas why SIGABRT would be thrown at the application by the UITesting? Is there a reason why I can't call this in different test suites? Is there a way to even separate out UI tests into multiple swift files?

like image 870
qqq Avatar asked Jun 28 '26 12:06

qqq


1 Answers

I figured it out: I have two targets (one for unit tests, the other for UI tests). I had accidentally added the UI test file to the non-UI-test target, so when running tests from both targets, the XCUIApplication() method tried to access the app in a way that the unit tests, which don't use XCUITest, didn't like. Solution: remove all XCUITest sources from "Compile sources" on the other test target.

like image 149
qqq Avatar answered Jul 01 '26 10:07

qqq



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!