MS Teams

You can post test results to a Microsoft Teams channel by creating a tagged after hook as follows:

def send_teams_channel_message(message)
    uri = URI.parse('<enter your secret key here>')
    header = {'Content-Type': 'application/json'}
    body = {text: message}.to_json
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    request = Net::HTTP::Post.new(uri.request_uri, header)
    request.body = body

    response = http.request(request)
    #puts response.code
end
After ('@teams') do |scenario|
    if (scenario.failed?)
        message = "Scenario failed on #{Capybara.app_host} - #{scenario.name}"
    else
        message = "Scenario passed on #{Capybara.app_host} - #{scenario.name}"
    end
    send_teams_channel_message(message) #send teams message to channel
end

Step 1:

Step 2:

Step 3:

Step 4:

This is the Workflow setup:

This is what it looks like when posted: