How to test an iOS library using UIKit

I would like to create a library for iOS applications that uses UIKit. In addition, I would like to create unit tests for this library. Unfortunately, my tests do not work due to UIKit ( [UIFont systemFontOfSize:12.0] , to be precise).

According to the Apple Unit Test Guide, there are two types of test cases: logic tests and application tests. Application tests seem to be correct for tests related to materials related to UIKit, but I did not learn how to configure application tests for libraries. Has anyone ever had the same problem and were able to solve it?

Thanks a lot!

+6
source share
1 answer

I have found a solution to this. You must add a new goal to your project, which is just an empty application. Then use this application as a test host, following the instructions for this using a regular application, for example here:

Why does creating an UIFont instance in the iphone unit test fail?

+5
source

Source: https://habr.com/ru/post/902634/