Skip to content

Instantly share code, notes, and snippets.

@sanjay-io
Created May 16, 2018 15:03
Show Gist options
  • Save sanjay-io/daa7d42131bcd0b0d8f373d2b68dec34 to your computer and use it in GitHub Desktop.
Save sanjay-io/daa7d42131bcd0b0d8f373d2b68dec34 to your computer and use it in GitHub Desktop.
Fastlane command being used.
lane :test do |options|
only_testing = ["APITests", "ClasspassTests", "UITests"]
data_dog_time_report = 'test'
if options[:uitests]
only_testing = ["UITests"]
data_dog_time_report = 'uitest'
end
clean = options[:clean]
report_time_elapsed_to_datadog(data_dog_time_report) do
output_directory = ENV["CIRCLE_ARTIFACTS"] ? ENV["CIRCLE_ARTIFACTS"] : '/tmp/artifacts'
test_server_output_directory = "#{output_directory}/test-server.log"
system("mkdir -p #{output_directory}")
system("touch #{test_server_output_directory}")
system("node ../../fixture-api/index.js > #{output_directory}/test-server.log &")
output_file = "#{output_directory}/Development-Development.log"
begin
# This is the fastlane command.
scan(
workspace: "Classpass.xcworkspace",
devices: ["iPhone 8"],
scheme: "Development",
configuration: "Test",
output_directory: output_directory,
buildlog_path: output_directory,
clean: clean,
code_coverage: true,
skip_slack: true,
only_testing: only_testing,
include_simulator_logs: false
)
report_value_to_datadog("tests.failing", "success")
rescue => ex
report_log_lines_to_datadog("tests.failing", output_file, "Test Case '.*' failed")
report_value_to_datadog("tests.failing", "failure")
raise "Unit Tests Failed"
end
end
if !options[:uitests]
sh "bundle exec fastlane coverage report:true"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment