Reputation: 1430
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?
Upvotes: 3
Views: 1832
Reputation: 1430
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.
Upvotes: 0