{"action":"created","issue":{"url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/4755","labels_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/4755/labels{/name}","comments_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/4755/comments","events_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/4755/events","html_url":"https://github.com/CocoaPods/CocoaPods/issues/4755","id":126196343,"number":4755,"title":"How do I unit test a Cocoapods library ? ","user":{"login":"thecritic","id":3063603,"avatar_url":"https://avatars.githubusercontent.com/u/3063603?v=3","gravatar_id":"","url":"https://api.github.com/users/thecritic","html_url":"https://github.com/thecritic","followers_url":"https://api.github.com/users/thecritic/followers","following_url":"https://api.github.com/users/thecritic/following{/other_user}","gists_url":"https://api.github.com/users/thecritic/gists{/gist_id}","starred_url":"https://api.github.com/users/thecritic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thecritic/subscriptions","organizations_url":"https://api.github.com/users/thecritic/orgs","repos_url":"https://api.github.com/users/thecritic/repos","events_url":"https://api.github.com/users/thecritic/events{/privacy}","received_events_url":"https://api.github.com/users/thecritic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2016-01-12T14:51:40Z","updated_at":"2016-01-12T16:02:37Z","closed_at":null,"body":"I am trying to figure out how to set up simple unit testing for my Cocoapods library. \r\n\r\nHere is what I tried: \r\n\r\nI added a unit testing target 'MyTestTarget' to the 'Pods' Project, edited my 'MyCocoapodLib' scheme to add the test target. Then I created classes for my unit tests with Nimble and Quick. I then added the test classes to the test target and everything went smooth, testing worked. I can now select my 'MyCocoaPodLib' scheme and press CMD+U and the testing target executes the tests. This is the behaviour I am looking for.  \r\n\r\nThis approach however has some drawbacks (?). If I do 'pod update' on my example app, the test target is gone (Cocoapods probably sets up targets in the background and my target ends up lost). Also I would like to prevent the test classes from being loaded into any consumers using the library, therefore I added an exclusion to my podspec: \r\n\r\n    s.exclude_files = 'Pod/Classes/**/Test/*'\r\n\r\nWith this line I basically eliminate all test classes from being included. However, if I call pod update on my Example application, the tests are gone too. I'm certain there is a correct way to do this, this doesn't seem to cut it. \r\n\r\nHere's the thing though: \r\n\r\nI am unsure if this is the right way to do this because I noticed that there already is a target called 'Pods-MyCocoapodLib_Tests'. Is this an actual test target ? If so, how do I add and execute unit tests against 'MyCocoapodLib' scheme ? I would love to associate the test target with my CocoaPods library and just press CMD+U. \r\n\r\nI apologize in advance for my limited knowledge about this, but even after searching for it extensively and consulting multiple sources I could not find any useful resources to help me shed some light on this. \r\n\r\nAny help would be greatly appreciated. "},"comment":{"url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/comments/170957868","html_url":"https://github.com/CocoaPods/CocoaPods/issues/4755#issuecomment-170957868","issue_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/4755","id":170957868,"user":{"login":"orta","id":49038,"avatar_url":"https://avatars.githubusercontent.com/u/49038?v=3","gravatar_id":"","url":"https://api.github.com/users/orta","html_url":"https://github.com/orta","followers_url":"https://api.github.com/users/orta/followers","following_url":"https://api.github.com/users/orta/following{/other_user}","gists_url":"https://api.github.com/users/orta/gists{/gist_id}","starred_url":"https://api.github.com/users/orta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orta/subscriptions","organizations_url":"https://api.github.com/users/orta/orgs","repos_url":"https://api.github.com/users/orta/repos","events_url":"https://api.github.com/users/orta/events{/privacy}","received_events_url":"https://api.github.com/users/orta/received_events","type":"User","site_admin":false},"created_at":"2016-01-12T16:02:37Z","updated_at":"2016-01-12T16:02:37Z","body":"The `Pods` structure is not meant to be touched, he means to your project. You need to have a separate xcodeproject that holds things like the test target + tests."}}