Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UI Testing in Swift Package

I am building a Swift Package library that provide some UI components, for both macOS and iOS.

I would like to be able to test this codebase and cover my code with unit test for both platforms.

Is there a way to manage that ?

like image 650
Q. Eude Avatar asked Jul 01 '26 06:07

Q. Eude


1 Answers

As of Swift 5.4, the Swift Package Manager doesn't provide that functionality out of the box.

To carry out UI tests, you need to create a separate app (in its separate xcode project), whose only purpose is to import the package and run UI tests via xcodebuild commands (as swift test won't work).

like image 65
Eric Avatar answered Jul 03 '26 07:07

Eric



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!