bhartsb
bhartsb

Reputation: 1366

Unit Testing Custom iOS Framework with or without Host Application

I have a custom iOS framework written in Swift that presents AVCaptureVideoPreviewLayer and also presents some custom popup screens. I want to add unit tests and wondering if I can do this without having a host App specified and instead programmatically create a minimal host app.

Some resources I've found that seem to be moving in the direction but were not written with unit testing frameworks in-mind:

https://marcosantadev.com/fake-appdelegate-unit-testing-swift/

https://qualitycoding.org/ios-app-delegate-testing/

Upvotes: 2

Views: 2517

Answers (1)

Jon Reid
Jon Reid

Reputation: 20980

It sounds like you want to some test interactions with UIKit, so you'll need a host application. Just make a new empty app as one of your targets, and use it.

Can this be done programmatically? No. The alternative (worth trying at first) is to forego certain kinds of tests. See how far you can get before you add a host app.

Upvotes: 2

Related Questions