Notes on configuring test targets
❤️ Support my app ❤️
❤️❤️😇😍🤘❤️❤️
Notes on configuring test targets
Dependencies used
Examples
Errors occur mostly due to linker error
Test targets need to include pods that Main target uses !
or we'll get "Framework not found"
def app_pods
pod 'Sugar', '~> 1.0'
end
def test_pods
pod 'Nimble', '~> 3.2'
pod 'Quick', '~> 0.9'
end
target 'TeaApp' do
app_pods
end
target 'TeaAppTests' do
app_pods
test_pods
end
target 'TeaAppUITests' do
app_pods
test_pods
end
Cocoapods builds a framework that contains all the frameworks the Test targets need, and configure it for us
$(FRAMEWORK_SEARCH_PATHS)
We usually have
github "hyperoslo/Sugar" ~> 1.0
github "Quick/Nimble"
github "Quick/Quick"
Carthage/Build
Configure correct path
$(FRAMEWORK_SEARCH_PATHS)
From Adding frameworks to unit tests or a framework
In rare cases, you may want to also copy each dependency into the build product (e.g., to embed dependencies within the outer framework, or make sure dependencies are present in a test bundle). To do this, create a new “Copy Files” build phase with the “Frameworks” destination, then add the framework reference there as well.
Question
Reference
Khoa Pham, [email protected]
TestTarget is available under the MIT license. See the LICENSE file for more info.