Skip to content

Instantly share code, notes, and snippets.

@lottadot
Created January 29, 2013 19:42
Show Gist options
  • Save lottadot/4667075 to your computer and use it in GitHub Desktop.
Save lottadot/4667075 to your computer and use it in GitHub Desktop.
Running Unit tests from command line (ie Xcode 4.52/4.6 and Jenkins). We install ios-sim gem, add a buildtarget to run from CLI and this as a run script at on that build target
if ENV['SL_RUN_UNIT_TESTS'] then
#launcher_path = File.join(ENV['SRCROOT'], "Scripts", "ios-sim")
launcher_path = "/usr/local/bin/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"])
system("#{launcher_path} launch \"#{app_test_host}\" #{environment_args} --args -SenTest All #{test_bundle_path}")
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