Skip to content

Latest commit

 

History

History
178 lines (135 loc) · 6.26 KB

README.md

File metadata and controls

178 lines (135 loc) · 6.26 KB

testblame

This CLI tool to gather failed tests based on git commit history and sends emails

Features | Installation | Usage | Examples | ScreenShots | Contribution | License | Version |

About

testblame is a cli tool that will gather all failed tests from Jenkins Junit report and provide you sorted report with a map of author and tests based on there git commit history for single and multiple authors. It also provides failed tests based on component or also tags.

By this tool, you can find out your own failed tests based in git commit from more than 500 failed tests. By this way, you will rid of a pain finding your own failed tests from JUnit test report and you do not have to remember your test.

1. Features

  • Find out your own failed tests based on git commit history using GitHub email
  • Generate and send email report with a map of an author and failed tests based on git commit history
  • Generate and send email report with a map of an author and failed tests based on component JSON
  • See all failed tests
  • See all failed tests based in tags

2. Installation

2.1 Linux/BSD

git clone https://github.com/omkarkhatavkar/testblame
cd testblame
sh setup.sh

3. Usage

3.1 Overview

To see all options with test blame, call the program without any arguments testblame on a console and see all help.

$ testblame 

Usage: testblame [OPTIONS] COMMAND [ARGS]...

  This CLI tool to gather failed tests based on commit history

Options:
  --help  Show this message and exit.

Commands:
  refresh-config     Update config, pass new Jenkins test-result url
  send-email-report  Send an email report based on git commit history
  set-config         Set git_url and jenkins_url to collect the failed tests
  show-all-tests     Show all failed test names
  show-my-tests      Pass GitHub email to see failed tests

3.2 Set-Config TestBlame

testblame set-config command should be run as first, by that way testblame knows your Jenkins url to fetch failed tests and repo url from where to get git commit history.

$ testblame set-config --help


Usage: testblame set-config [OPTIONS]

  Set git_url and jenkins_url to collect the failed tests

Options:
  --git-url TEXT      Pass the git url for test repo
  --jenkins-url TEXT  Pass the Jenkins url to collect the failed tests
  --help              Show this message and exit.

3.3 Show-My-Test TestBlame

testblame show-my-test will show only specific git hub user's failed tests based on git commit history

$ testblame show-my-test --help

Usage: testblame show-my-tests [OPTIONS]

  Pass GitHub email to see failed tests

Options:
  --local-repo TEXT  Provide test local repo if required
  --filter TEXT      Pass filter if local-repo is enabled
  --email TEXT       Pass email to get tests based on git commit history
  --skip TEXT        Pass search string to skip the specific tests
  --help             Show this message and exit.

3.3 Send-Email-Report TestBlame

testblame send-email-report will send an email report with author and test map table based on git commit history or component-based JSON. Send emails are currently integrated with SendGrid

$ testblame send-email-report --help

Usage: testblame send-email-report [OPTIONS]

 Send an email report based on git commit history

Options:
 --local-repo TEXT  Provide test local repo if required
 --email TEXT       Provide Email Report for Specific
 --skip TEXT        Pass search string to skip the specific tests
 --filter TEXT      Pass filter if local-repo is enabled
 --from_email TEXT  Pass from an email address
 --to_email TEXT    Pass to an email address
 --subject TEXT     Pass subject
 --component TEXT   pass JSON file path containing author and component tags
 --help             Show this message and exit.

4. Examples

Setting up testblame with configs such as git repo url and jenkins junit report url

 testblame set-config --git-url="https://github.com/reponame" --jenkins-url="<host>/view/job/<jobname>/lastCompletedBuild/testReport/" 

Now once testblame knows repo and failed tests, time to know failed tests based on git-email-id

testblame show-my-tests --email="okhatavk"
Searching failed tests  [####################################]  100%          
tests.ui.testname_1 ⇒ Failed
tests.cli.testname_1 ⇒ Failed

Want to see only UI tests?

testblame show-my-tests --email="okhatavk" --skip=cli
Searching failed tests  [####################################]  100%          
tests.ui.testname_1 ⇒ Failed

Want to see only based on tag or filter or component?

testblame show-my-tests --email="okhatavk" --filter=dashboard
Searching failed tests  [####################################]  100%          
tests.cli.testname_dashboard_1 ⇒ Failed
tests.cli.testname_dashboard_2 ⇒ Failed
tests.cli.testname_dashboard_3 ⇒ Failed

Generate and send email report for whole team based on git commit history ?

testblame send-email-report --from_email="testblame@testblame.com" --to_email="okhatavk@testblame.com" --subject="Testing Result Tier 1" 

Generate and send email report for the whole team based on component.json?

$ cat component.json 
{
"Omkar": [
  "Test_1",
  "Test_10",
  "Test_11"
],
"Rakesh": [
  "Test_2"
]
}
testblame send-email-report --from_email="testblame@testblame.com" --to_email="okhatavk@testblame.com" --subject="Testing Result Tier 1" --component.json

5. Screenshots

Showing some screenshots

Screencast

6. Contribution

Contributions are welcome. Please check the issues and feel free to open a pull request.