Github actions to notify the test result from junitxml file to any slack channel
There is a demo in youtube of this plugin: - https://youtu.be/KhZ1TdRjTy0
Be it any type of tests - unit/integration/api in any language - java/python, you can generate JUNITXML easily as all languages provide this out of box.
For example if you are using pytest (python), then you can generate junitxml report like this:
pytest <test> --junitxml=<reportname>
So, a junitxml report with a slackbot can use this github action to post crisp & clear message conveying the test result. Test result status follows jenkins convention
- Passed All tests have passed
- Unstable Few tests have not passed
- Failure No tests have passed
name: Notify in Slack Channels
on: workflow_dispatch
jobs:
notify-slack:
runs-on: ubuntu-latest
name: A job to notify in slack with my github actions
environment: Slackbot Notification
steps:
- uses: actions/checkout@v2
- name: Notify Slack Test Result
uses: sanjaykrishnanrs/[email protected]
with:
title: API Tests
slackbotid: ${{ secrets.SLACKBOTID }}
slackbottoken: ${{ secrets.SLACKBOTTOKEN }}
slackchannel: '${{ secrets.SLACKCHANNEL }}'
junitxml_filepath: junitreport.xml
A slackbot configured in slack and added as an app to the channel where the message has to be sent.
Read more - https://slack.com/intl/en-in/help/articles/115005265703-Create-a-bot-for-your-workspace
The scripts and documentation in this project are released under the MIT License
Contributions are welcome! Create a branch or Fork the repo - Start doing !