Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whats the alternative of @testable import in Objective C

I am working with Unit Testing in Xcode using XCTest provided by Xcode in objective C. I know how to import Module in Swift like below.


@testable import  AppName

Whats the alternative in objective C.

like image 297
Babul Prabhakar Avatar asked Apr 27 '16 12:04

Babul Prabhakar


People also ask

Should I include tests Xcode?

You do not need to include unit tests. Unit testing is a method by which individual units of source code are tested to determine if they are fit for use. A unit is the smallest testable part of an application.

How do I add unit tests to an existing Xcode project?

To add a unit test target to an existing Xcode project, choose File > New > Target. Select your app platform (iOS, macOS, watchOS, tvOS) from the top of the New Target Assistant. Select the Unit Testing Bundle target from the list of targets.


1 Answers

In Objective C you can simply #import them, as there are no such "internal" method access limitations as in Swift.

Also, On Xcode 6 your main target should be already linked to the test target. If not, try to check the "Allow testing Host Application APIs" checkbox inside Your Test Target > General > Testing. Take a look at this question for more information.

like image 102
Tomer Avatar answered Oct 13 '22 06:10

Tomer