Skip to content

Github actions to notify the test result from junitxml file to any slack channel

Notifications You must be signed in to change notification settings

dibyaranjan-pg/slack-notify-junitxml-action

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slack-notify-junitxml-action

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

What does this github action do ?

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

Slack Message examples

Slack message

Usage

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

Pre-requisite

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

License

The scripts and documentation in this project are released under the MIT License

Contributions

Contributions are welcome! Create a branch or Fork the repo - Start doing !

About

Github actions to notify the test result from junitxml file to any slack channel

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 81.6%
  • Dockerfile 18.4%