I can't find a solution for a pretty trivial (IMHO) setup.
In my iOS application I use Fastlane to run tests through a scan
command.
This generates a pretty useful xpretty tests report HTML file.
I would like to send a slack notification at the end of the tests with attached link to my generated HTML tests results file. I am using a Gitlab with a runner installed on a minimac to run my CI pipeline.
So far I cannot find a solution to this setup. Can someone point me to the right direction ?
With TestProject you now have the option to receive easy to read summary reports of your test automation job executions with Slack notifications. Whether your job was executed manually, by a schedule or from a CI tool build like Jenkins.
To trigger fastlane, just add the command you would usually run from your terminal: If you want to post test results on Slack, Hipchat or other team chat client, check out the available fastlane actions. If you're using Slack, this is already built-into the default run_tests action, just provide your Slack URL:
To run your unit tests or UI tests using fastlane, add the following to your Fastfile Additionally you can specify more options for building and testing your app, for example To run iOS tests using fastlane on a Continuous Integration service, check out the Continuous Integration docs.
Select Preferences from the menu to open your notification preferences. Scroll down to Flash window when a notification is received and select Always. Tip: Selecting the preference Always will also keep the Slack icon in the taskbar when the app window is closed.
I hope you already found a solution in the latest 2 years. As pointed in the comments, you can use the webhooks of Slack. And then you can run the slack
command in your steps like this:
platform :ios do
before_all do
ENV["SLACK_URL"] = "https://hooks.slack.com/services/T0A6LPW3A/B5B2SBA13/etc..."
desc "Tests, builds and uploads to iTunesConnect"
lane :appstore do
ENV["LANE_NAME"] = "Flicker"
ENV["BUNDLE_ID"] = "com.epri.fem"
ENV["SCHEME_NAME"] = ENV["LANE_NAME"]
ENV["TEAM_NAME"] = "Electric Power Research Institute"
runConfiguration()
end
def runConfiguration()
slack(
message: ENV["LANE_NAME"] + ") Incoming from branch " + sh("git rev-parse --abbrev-ref HEAD") + " - " + sh("git rev-parse HEAD"),
slack_url: ENV["SLACK_URL"]
)
sigh(team_name: ENV["TEAM_NAME"],
app_identifier: ENV["BUNDLE_ID"],
skip_certificate_verification: true) # Update Provisioing Profiles / Code Signing
slack(
message: "Finished updating provisioing profiles",
default_payloads: [],
slack_url: ENV["SLACK_URL"]
)
scan(
scheme: ENV["SCHEME_NAME"],
slack_url: ENV["SLACK_URL"]
) # run tests
gym(scheme: ENV["SCHEME_NAME"],
clean: true) # build the app
slack(
message: "Finished building app",
default_payloads: [],
slack_url: ENV["SLACK_URL"]
)
pilot(skip_submission: true,
team_name: ENV["TEAM_NAME"]) #upload to test flight
slack(
message: "Finished archiving and uploading to iTunesConnect",
default_payloads: [],
slack_url: ENV["SLACK_URL"]
)
end
error do |lane, exception|
slack(
message: exception.message,
default_payloads: [],
slack_url: ENV["SLACK_URL"]
)
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With