IOS tests carried out using fastlane
In Fastfile
add the following code to execute your UI unit test or tests
lane :tests do
run_tests(scheme: "MyAppTests")
end
Also you can more configuration options such as add to your test:
lane :tests do
run_tests(workspace: "Example.xcworkspace",
devices: ["iPhone 6s", "iPad Air"],
scheme: "MyAppTests")
end
View optional parameter list
the following code to work with the newly created task (lane)
fastlane tests
Continuous integration is set to fastlane
In order to use fastlane, reference devices on iOS continuous integration continuous integration documentation
Because fastlane stores all configuration and use the command line execution, it supports all types of continuous integration system (CI system).
We have also prepared a document for the more mainstream continuous integration system
Self-hosted (Self-Hosted) Formula CI
Hosted CI
If you are using a CI system is not listed, it does not matter, fastlane can be performed in any CI you simply enter the command line in the code to trigger fastlane.:
fastlane tests
Environment settings
Send compilation results
If you want to send the test results to Slack, Hipchat team or other chat tools, view the available Fastlane Actions .
Compilation failed
Slack
Slack is the default run_tests action
, you only need to provide your Slack URL:
lane :tests do
run_tests(scheme: "MyAppTests",
slack_url: "https://hooks.slack.com/services/T03N...",
slack_channel: "#channel")
end
Your Slack created as a group Incoming WebHook
to get slack_url
.
Other group chat service
, add the following code to transmit information when fastlane or packaged test failed:
error do |ex|
hipchat(message: "Tests have failed!",
channel: "Room or @username",
success: false)
end
The above example is the use of Hipchat, fastlane also supports other chat services .
Reproduced in: https: //www.jianshu.com/p/766efc68ad43