Last active
December 24, 2015 12:29
-
-
Save alabeduarte/6798241 to your computer and use it in GitHub Desktop.
Script for running iOS unit tests by command line inspired on http://stackoverflow.com/a/10823483/2839823
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ENV['SL_RUN_UNIT_TESTS'] then | |
launcher_path = "ios-sim" | |
test_bundle_path= File.join(ENV['BUILT_PRODUCTS_DIR'], "#{ENV['PRODUCT_NAME']}.#{ENV['WRAPPER_EXTENSION']}") | |
environment = { | |
'DYLD_INSERT_LIBRARIES' => "/../../Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection", | |
'XCInjectBundle' => test_bundle_path, | |
'XCInjectBundleInto' => ENV["TEST_HOST"] | |
} | |
environment_args = environment.collect { |key, value| "--setenv #{key}=\"#{value}\""}.join(" ") | |
app_test_host = File.dirname(ENV["TEST_HOST"]) | |
passed = system("#{launcher_path} launch \"#{app_test_host}\" --unit-testing #{environment_args} --args -SenTest All #{test_bundle_path}") | |
exit(1) if !passed | |
else | |
puts "SL_RUN_UNIT_TESTS not set - Did not run unit tests!" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment