{"action":"created","issue":{"url":"https://api.github.com/repos/fastlane/fastlane/issues/5344","repository_url":"https://api.github.com/repos/fastlane/fastlane","labels_url":"https://api.github.com/repos/fastlane/fastlane/issues/5344/labels{/name}","comments_url":"https://api.github.com/repos/fastlane/fastlane/issues/5344/comments","events_url":"https://api.github.com/repos/fastlane/fastlane/issues/5344/events","html_url":"https://github.com/fastlane/fastlane/issues/5344","id":164264908,"number":5344,"title":"Use launch arguments in XCTestCase directly","user":{"login":"bkrijgsman","id":7165151,"avatar_url":"https://avatars.githubusercontent.com/u/7165151?v=3","gravatar_id":"","url":"https://api.github.com/users/bkrijgsman","html_url":"https://github.com/bkrijgsman","followers_url":"https://api.github.com/users/bkrijgsman/followers","following_url":"https://api.github.com/users/bkrijgsman/following{/other_user}","gists_url":"https://api.github.com/users/bkrijgsman/gists{/gist_id}","starred_url":"https://api.github.com/users/bkrijgsman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkrijgsman/subscriptions","organizations_url":"https://api.github.com/users/bkrijgsman/orgs","repos_url":"https://api.github.com/users/bkrijgsman/repos","events_url":"https://api.github.com/users/bkrijgsman/events{/privacy}","received_events_url":"https://api.github.com/users/bkrijgsman/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/fastlane/fastlane/labels/snapshot","name":"snapshot","color":"0052cc"}],"state":"open","locked":false,"assignee":{"login":"vpolouchkine","id":915660,"avatar_url":"https://avatars.githubusercontent.com/u/915660?v=3","gravatar_id":"","url":"https://api.github.com/users/vpolouchkine","html_url":"https://github.com/vpolouchkine","followers_url":"https://api.github.com/users/vpolouchkine/followers","following_url":"https://api.github.com/users/vpolouchkine/following{/other_user}","gists_url":"https://api.github.com/users/vpolouchkine/gists{/gist_id}","starred_url":"https://api.github.com/users/vpolouchkine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vpolouchkine/subscriptions","organizations_url":"https://api.github.com/users/vpolouchkine/orgs","repos_url":"https://api.github.com/users/vpolouchkine/repos","events_url":"https://api.github.com/users/vpolouchkine/events{/privacy}","received_events_url":"https://api.github.com/users/vpolouchkine/received_events","type":"User","site_admin":false},"assignees":[{"login":"vpolouchkine","id":915660,"avatar_url":"https://avatars.githubusercontent.com/u/915660?v=3","gravatar_id":"","url":"https://api.github.com/users/vpolouchkine","html_url":"https://github.com/vpolouchkine","followers_url":"https://api.github.com/users/vpolouchkine/followers","following_url":"https://api.github.com/users/vpolouchkine/following{/other_user}","gists_url":"https://api.github.com/users/vpolouchkine/gists{/gist_id}","starred_url":"https://api.github.com/users/vpolouchkine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vpolouchkine/subscriptions","organizations_url":"https://api.github.com/users/vpolouchkine/orgs","repos_url":"https://api.github.com/users/vpolouchkine/repos","events_url":"https://api.github.com/users/vpolouchkine/events{/privacy}","received_events_url":"https://api.github.com/users/vpolouchkine/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-07-07T09:17:42Z","updated_at":"2016-07-14T16:51:33Z","closed_at":null,"body":"### New Issue Checklist\r\n\r\n- [x] Updated fastlane to the latest version\r\n- [x] I have read the [Contribution Guidelines](https://github.com/fastlane/fastlane/blob/master/CONTRIBUTING.md)\r\n\r\n### Issue Description\r\n\r\nHi, i'm trying to pass the launch arguments of snapshot directly to the XCTestCase, to perform different tests based on the configuration. My snapfile contains the following arguments\r\n\r\n```\r\nlaunch_arguments([\r\n  \"-hide_login false -login_type \"\r\n])\r\n```\r\n\r\nIn the XCTestCase is use the following code to retrieve the variables:\r\n\r\n`\r\n\r\n        let hideLogin = NSUserDefaults.standardUserDefaults().stringForKey(\"hide_login\") ?? \"not_found_hide_login\"\r\n         snapshot(hideLogin)\r\n        let loginType = NSUserDefaults.standardUserDefaults().stringForKey(\"login_type\") ?? \"not_found_login_type\"\r\n        \r\n        snapshot(loginType)`\r\n\r\n\r\nWhen i run snapshot, the program can't find the variables. What am i missing? :)"},"comment":{"url":"https://api.github.com/repos/fastlane/fastlane/issues/comments/232724449","html_url":"https://github.com/fastlane/fastlane/issues/5344#issuecomment-232724449","issue_url":"https://api.github.com/repos/fastlane/fastlane/issues/5344","id":232724449,"user":{"login":"bkrijgsman","id":7165151,"avatar_url":"https://avatars.githubusercontent.com/u/7165151?v=3","gravatar_id":"","url":"https://api.github.com/users/bkrijgsman","html_url":"https://github.com/bkrijgsman","followers_url":"https://api.github.com/users/bkrijgsman/followers","following_url":"https://api.github.com/users/bkrijgsman/following{/other_user}","gists_url":"https://api.github.com/users/bkrijgsman/gists{/gist_id}","starred_url":"https://api.github.com/users/bkrijgsman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkrijgsman/subscriptions","organizations_url":"https://api.github.com/users/bkrijgsman/orgs","repos_url":"https://api.github.com/users/bkrijgsman/repos","events_url":"https://api.github.com/users/bkrijgsman/events{/privacy}","received_events_url":"https://api.github.com/users/bkrijgsman/received_events","type":"User","site_admin":false},"created_at":"2016-07-14T16:51:33Z","updated_at":"2016-07-14T16:51:33Z","body":"I already saw that ticket. I used the following method:\r\n\r\n```\r\nfunc argValueForKey(key:String, app:XCUIApplication) -> String? {\r\n        if let index = app.launchArguments.indexOf(key) {\r\n            return app.launchArguments[index+1]\r\n        } else {\r\n            return nil\r\n        }\r\n    }\r\n\r\n//Fetch launch argument\r\nlet app = XCUIApplication()\r\nsetupSnapshot(app)\r\n\r\nlet testcase = argValueForKey(\"-testcase\", app:app) ?? \"0\"\r\n```\r\n\r\nAnd that worked :)"}}
{"actor":{"display_login":"bkrijgsman"}}