Skip to content

how to integrate robot run in Jenkins with build trigger in every push. Include robotmetrics dashboard generation in Jenkins as well.

Notifications You must be signed in to change notification settings

Anilkumar-Shrestha/robotframework-jenkins-run

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

robotframework-jenkins-run

This is a simple project to show how to integrate robot run in jenkins with freestyle project. Robotframework-jenkins-run also provide step by step to poll scm push to trigger the build. It also helps on using robotframework-metrics to view the dashboard report on jenkins.

Table of contents

  1. Pre-requisites
  2. Steps in Jenkins
  3. Email Notification configuration

Troubleshooting viewing report

1. Pre-requisites

  • Clone this project on your local computer.
https://github.com/Anilkumar-Shrestha/robotframework-jenkins-run.git
  • install Jenkins on your PC. for installation, follow steps as: install jenkins on windows note: Sometime you will find Jenkins under C:\windows\system32\config\systemprofile\AppData\Local\jenkins.jenkins folder after jenkis installation.
  • Go to "Manage Jenkins" in left bar and click on "plugin Manager". You will see the horizontal bar, click on Available and type "Robot Framework plugin" on search bar. Install the plugin without restart. jenkin_rf_plugin

2. Steps in Jenkins

  • Create New item. new_item_click
  • Give a suitable project name and select the free style project and click on OK button as shown. 2_name_freestyle_project
  • Go to Source code management and select Git radiobutton. Provide the repos url and give your credentials. scm

for Credential setting, please see the link Adding credentials

  • Go to Build trigger and select the Poll SCM button and enter 5 * with spaces to check changes in every minutes. poll-scm
  • Go to Build and click on Add build steps. It pop up the list where you should click on "Execute Window batch Command". 5_batch_build_step
  • Enter the below batch cmd on the command box as shown.
robot --outputdir testresults/ requestTest.robot &
robotmetrics -M outputReportMetrics.html --inputpath ./testresults/ --output output.xml --log log.html

6_execute_cmd

  • Go to Post-build Actions and click on Add build steps. Select "Publish robot framework test results". 7_publish_rfresults

  • Add testresults in directory and outputReportMetrics.html on Other files to copy box. CLick Save. 8_rfmetricsreport

  • Now, trigger job using Build Now. 9_buildnow

  • After build is complete, click on Robot results.
  • Click on Original result files.
  • Open "outputReportMetrics.html" report.

Email Notification configuration

If you want to configure the email notification in each build to send to the concern team member, we can achieve it through Jenkins. For this, please follow below steps for configuring.

  1. Adding Plugin and Configuring mail server.

    1. We need the "Email extension Plugin" to install in jenkins. For this, Go to "Manage plugins" in left bar and click on "plugin Manager". You will see the horizontal bar, click on available and type "Email extension Plugin" on search bar. Install the plugin without restart. email_extension_plugin
    2. You need to configure the smtp server. Go to Manage Jenkins and click on configure system. configure_system
    3. Search for "Extend" and you will land to email configure page. Add All the information as highlighted. i.e
      • Enter your smtp server name. For example I have entered google. You can check this site for more information on other smtp server.
      • Click “Use SMTP Authentication” and enter required information. smtp_configure
    4. Enter the similar information in E-mail notifications. You can check Check “Test configuration by sending test e-mail”. Click “Test configuration” to send test email.
      • You should enable imap on your email settings. enable_imap_gmail
      • After that you can Test email configurations. test_email_configuration
    5. Click “Save” in the bottom of the page
  2. Then, Go to your project and click on Configure as shown. jenkin_project_configure

  3. Go to Post-build Actions tab and click on "Add post build actions" list menu. You will see Editable email notification, click on that. editable_email_notifications

  4. Now, you will see some information you can input for customizing the email.

    • Add the EmailID in Project from to show from where you are going to send the email. Similar to the recipient list. You can add customize message as shown.
    • You can attach output result file to the message through attachment section. postbuild_input
    • Go to Advance Setting as below for adding the recipient.
      advance_email_setting
    • On the trigger section, click on Add and add Recipient list. send_to_recipentlist
    • Click "Add Trigger", and select "Always" to add to Recipient list. add_trigger_always
  5. Click Apply and Save.

  6. Click Build Now and enjoy your day.

Troubleshooting report

If you get an error below while opening html. Please follow the steps. issue_viewing_html

  1. Try enabling javascript for browser. example for chrome.
  2. If that doesn't work :
  • Go to C:\Program Files (x86)\Jenkins
  • edit jenkins.xml file and add below code snippet in the file removing the existing one.
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dhudson.model.DirectoryBrowserSupport.CSP="" -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>

solution_html_vie

About

how to integrate robot run in Jenkins with build trigger in every push. Include robotmetrics dashboard generation in Jenkins as well.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published