Skip to content

jessezach/robotframework-metrics

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robot Framework Metrics Report

Creates HTML Metrics report based on robotframework output.xml.

HitCount Github All Releases Github Releases (by Release) GitHub release PRs Welcome Maintenance Open Source Love png1


  • Sample Report link
  • What's new in _v3.1.1 link

How it Works:

  1. Read output.xml file using robotframework API
  2. Get Suite, Test Case , Keyword , Status and Elapsed time values
  3. Convert data to html report using Beautifulsoup

How to use in project:

  1. Download robotmetrics.py from here link

  2. Copy robotmetrics.py file to project

  3. Install beautifulsoup: (to create html report - one time activity)

    pip install beautifulsoup4
    
  4. Execute robotmetrics.py file

    Case 1: robotmetrics.py is copied where output.xml is available

    python robotmetrics.py
    

    Case 2: Specify output.xml file path. (When .xml and .html file names are same)

    python robotmetrics.py -inputpath .\Result\
    

    Case 3: Specify file name. (When .xml and .html file names are altered)

    python robotmetrics.py -inputpath .\Result\ -output voutput.xml -report vreport.html -log vlog.html
    
  5. RobotFramework Metrics Report metric-timestamp.html file will be created in current folder | -inputpath if specified

  6. Email will be sent to mentioned recepient with metric-timestamp.html file


Customize Report

Specify Logo and custom links in Robotframework metrics:

  • Custom Logo : Customize your logo by modifying robotmetrics.py file at line no: 21

    logo = "https://cdn.pixabay.com/photo/2016/08/02/10/42/wifi-1563009_960_720.jpg"
    
  • Custom Links : You can customize your links in report by modifying robotmetrics.py file at line no: 309-320. Modify href and text

    <ul class="nav flex-column mb-2">
        <li class="nav-item">
            <a style="color:blue;" class="tablink nav-link" target="_blank" href="https://www.github.com">
            <i class="fa fa-external-link"></i> Git Hub
            </a>
        </li>
        <li class="nav-item">
            <a style="color:blue;" class="tablink nav-link" target="_blank" href="https://www.jira.com">
            <i class="fa fa-external-link"></i> JIRA
            </a>
        </li>
    </ul>
    

How to Specifiy EMAIL recepients

  • In robotmetrics.py file add specific TO, FROM, SUBJECT, EMAIL server and etc., info (line no:98-113)

    if send_email in ['true', '1', 't', 'y', 'yes']:
      server = smtplib.SMTP('smtp.gmail.com:587')
    
    msg = MIMEMultipart() 
    msg['Subject'] = 'MyProject Automation Status'
    
    sender = '[email protected]'
    recipients = ['[email protected]', '[email protected]']
    ccrecipients = ['[email protected]', '[email protected]']
    
    msg['From'] = sender
    msg['To'] = ", ".join(recipients)
    msg['Cc'] = ", ".join(ccrecipients)
    password = "*************"
    

How to Disable EMAIL

  • By default email will be sent to mentioned recpients when .py file is executed. Using -email false (or) -email f can disable send email.

    python robotmetrics.py -email false
    
  • Email will be sent when following condition is met

    -email true | 1 | t | y | yes
    

How to Ignore Library Keywords in Metrics Report

  • In robotmetrics.py file add specific library keywords ignore_library
  • In Metric report, keywords with type value 'for' and 'foritem' are ignored
  • Following library keywords are ignored in Metrics Report
    ignore_library = [
     'BuiltIn',
     'SeleniumLibrary',
     'String',
     'Collections',
     'DateTime',
    ] 
    

Generate robotframework-metrics after execution

Execute .py file after suite or test execution as follows:

  • Create .bat (or) .sh file with following snippet

    robot test.robot &&
    python robotmetrics.py
    

    && is used to execute multiple command's in .bat file

  • Modify robot command as required and execute .bat file

  • Robotframework metrics will be created after execution


Thanks for using robotframework-metrics!

  • What is your opinion of this report?
  • What’s the feature I should add?

If you have any questions / suggestions / comments on the report, please feel free to reach me on [email protected]


Credits:

  1. Robotframework link
  2. Stackoverflow link
  3. Google charts link
  4. DataTable link
  5. BeautifulSoup link
  6. Jquery | JavaScript link
  7. Bootstrap link
  8. Icons8 link
  9. FontAwesome link

About

Generation of metrics report based on robotframework output.xml

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 95.2%
  • Python 4.8%