Pages

Running Selenium Cucumber Tests in Jenkins

This article shows how to configure and run Selenium (+ Cucumber) Tests in Jenkins. Before we dive into more details we have to have Jenkins installed in a server. Here is a quick way to setup Jenkins in a linux server.

OK all done, lets go though with the steps,

Step 1
First you need to install google chrome. This is called as chrome in headless mode. Because you really can't see the chrome window when you are running tests in Jenkins.

 wget -qO - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -  
 sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'  
 sudo apt-get update  
 sudo apt-get install google-chrome-stable  

Step 2
Then install xvfb. OK what is this xvfb ?
Based on Wikipedia,

Xvfb or X virtual framebuffer is a display server implementing the X11 display server protocol. In contrast to other display servers, Xvfb performs all graphical operations in memory without showing any screen output. From the point of view of the client, it acts exactly like any other X display server, serving requests and sending events and errors as appropriate. However, no output is shown. This virtual server does not require the computer it is running on to have a screen or any input device. Only a network layer is necessary.


 sudo apt-get install xvfb  

Then start xvfb
 Xvfb :1 -screen 5 1024x768x8 &  


Step 3
OK , server changes are done. Now its time to move into Jenkins configurations.

First Install this plugin, (Jenkins -> Manage Jenkins --> Manage Plugins)
https://wiki.jenkins-ci.org/display/JENKINS/Cucumber+Reports+Plugin

Why do you we need this ?
This plugin allows Jenkins to show Selenium + cucumber results as a graph with screenshots.

So in order to generate graphs this plugin need the report.json file that generated from Selenium + cucumber.

 @RunWith(Cucumber.class)  
 @Cucumber.Options(glue = {"classpath:com/rd/uat"}, strict = true, format = {  
     "pretty", "html:target/cukes", "json:target/cukes/report.json", "junit:target/cukes/junit.xml"})  
 public class RunCukes {  
 }  


Here is the plugin configuration in Jenkins.
Create Jenkins Job --> Then add this as "Post build Step"


Step 4
Add following environment variable to Jenkins. (Jenkins --> Manage Jenkins --> Configure System)

 DISPLAY=:1.5  

OK We just configure Jenkins to run selenium and Cucumber Tests.
Now run the Jenkins job and check the cucumber reports. :)
Here are some sample reports,



76 comments:

  1. In the provided information i agree our all information and really very nice all articles ,thanks for sharing in this post.
    I like in this post.
    php training in chennai

    ReplyDelete
  2. Hai,

    Nicely written post. I am just about to start a new blog and there could not have been a better guide than this one for some good pointers. I am looking forward to starting a successful blog after reading this incredibly useful post of yours. Waiting for more such posts like this.

    Keep writing and sharing!

    – Rithika

    SEO Training in Chennai

    ReplyDelete
  3. This information is impressive..I am inspired with your post writing style & how continuously you describe this topic. After reading your post,thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic..
    Peridot Systems Adyar Complaints

    ReplyDelete
  4. the blog is very interesting and will be much useful for us. thank you for sharing the blog with us. please keep on updating.
    Informatica Training in Chennai Adyar

    ReplyDelete
  5. this is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.
    Digital Marketing Services in Chennai

    ReplyDelete
  6. thank you for sharing such a great blog with us. expecting for your updation.
    Android training in chennai

    ReplyDelete
  7. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
    Digital Marketing Company in India

    ReplyDelete
  8. Thank you for sharing such a nice and interesting blog with us. Hope it might be much useful for us. keep on updating...!!
    seo company in india
    digital marketing company in india

    ReplyDelete
  9. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
    Java Training in Chennai

    ReplyDelete
  10. Interesting blog about running selenium cucumber test which attracted me more.Spend a worthful time.keep updating more.
    MSBI Training in Chennai

    ReplyDelete
  11. Nice Information Regarding Selenium Cucumber Tests in Jenkins My sincere thanks for sharing this post Please Continue to share this post
    Selenium Training in Chennai

    ReplyDelete
  12. Thanks Admin Amazing Post Keep UpDate.Thank You.

    Top 10 Most Popular Internet Marketing Tools,Black Hat Vip Seo Software,Website Seo Backlinks Software,Website Traffic Bot Software.Etc Free Download Online Please Visit Our Website

    http://best-premium-seo-tools.blogspot.com

    ReplyDelete
  13. The great service in this blog and the nice technology is visible in this blog. I am really very happy for the nice approach is visible in this blog and thank you very much for using the nice technology in this blog

    software testing training in chennai

    ReplyDelete
  14. Nice post.Thank you so much for sharing.Yiioverflow is a web development company.We have well expert team in Angular JS, Ionic, Yii Framework, Node JS, Laravel, PHP, MySQL, and WordPress.If you want a developer visit.. https://yiioverflow.com/

    ReplyDelete
  15. Thanks for your informative post. Selenium is the future of IT world to improve the quality of products.

    Selenium Training institute in Chennai
    Selenium Course in Chennai

    ReplyDelete
  16. Nice blog. Thanks for sharing such great information. App in minute provides you the platform you seek for creating your online store. App in minute can develop your Android Application & Website for free and display your products or services to the world. Once you create your Application & Website people will be able to know about your products and services as everyone is searching 24 X 7 for something to buy on the internet. For more information https://www.appinminute.com/

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete
  18. Thanks for such a great article here. I was searching for something like this for quite a long time and at last, I’ve found it on your blog. It was definitely interesting for me to read about their market situation nowadays. Well written article Thank You for Sharing with Us pmp training in chennai | pmp training class in chennai | pmp training near me | pmp training courses online | pmp training fee | project management training certification | project management training in chennai | project management certification online |

    ReplyDelete
  19. I like your article very much. It has many useful ideas and suggestions. I thinks it will be more helpful for my research in an efficient manner. Please try to post some more topics as well as possible.
    Python Training Institute in Chennai
    Best Python Training in Chennai
    best german classes in chennai
    German language training in chennai
    Devops Training in Chennai
    RPA Training in Chennai

    ReplyDelete
  20. Your blog was really nice about the spring security. Your blog always helps me a lot as i am associated with application support services in USA
    .So thank you very much and keep up the good work.

    ReplyDelete

  21. cheapest dogs to buy cheap toy boxes subscription boxes to over five hundred,000 monthly subscribers. Deeper insights into BarkBox's rating
    https://www.smore.com/04vs7-barkbox-super-chewer-reviews

    ReplyDelete
  22. It is very good and very informative. There is a useful information in it.Thanks for posting...
    https://www.apponix.com/

    ReplyDelete
  23. Great efforts put to publish these kinds of articles that are very useful to know. I’m thoroughly enjoying your blog. And Good comments create great relations. You’re doing an excellent job. Keep it up.

    Magento Development Training Course in Chennai Zuan Education

    Selenium Training Course in Chennai Zuan Education

    ReplyDelete
  24. Nice post. Thanks for sharing! I want people to know just how good this information is in your article. It’s interesting content and Great work.
    Digital Marketing Course In Kolkata
    Web Design Course In Kolkata

    ReplyDelete
  25. This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck.
    data analytics courses

    ReplyDelete
  26. wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries. keep it up.
    data analytics course in Bangalore

    ReplyDelete
  27. Hey, i liked reading your article. You may go through few of my creative works here
    Glitch
    Exercism

    ReplyDelete
  28. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    Correlation vs Covariance
    Simple linear regression
    data science interview questions

    ReplyDelete
  29.  You are really performing grand work. I must articulate that you really have done a great research before writing. Keep up the good work!
    Data Science training in Mumbai
    Data Science course in Mumbai
    SAP training in Mumbai

    ReplyDelete
  30. very well explained. I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    Correlation vs Covariance
    Simple Linear Regression
    data science interview questions
    KNN Algorithm
    Logistic Regression explained

    ReplyDelete

  31. It is very beneficial information for me, I am really impressed. This is a very nice article and continues sharing with us…
    MVC Training in Chennai
    Inplant Training in Chennai
    Soft Skills Training in Chennai
    JMeter Training in Chennai
    Appium Training in Chennai

    ReplyDelete
  32. This is really too useful and have more ideas and keep sharing many techniques. Eagerly waiting for your new blog keep doing more.
    DevOps Training in Chennai
    DevOps Training in Bangalore
    DevOps Online Training
    DevOps Training in Coimbatore
    DevOps Training in Pune

    ReplyDelete
  33. Really wonderful blog! Thanks for taking your valuable time to share this with us. Keep us updated with more such blogs.
    AWS Training in Chennai
    AWS Online Training
    AWS Training in Bangalore
    AWS Training in Pune
    AWS Training in Coimbatore

    ReplyDelete
  34. This comment has been removed by the author.

    ReplyDelete
  35. This is very useful blog for me. It holds the valid information. This article is nice and interesting. Thank you for sharing this wonderful blog. Keep updating more. AWS Training in Pune

    ReplyDelete
  36. Fantastic blog extremely good well enjoyed with the incredible informative content which surely activates the learners to gain the enough knowledge. Which in turn makes the readers to explore themselves and involve deeply in to the subject. Wish you to dispatch the similar content successively in future as well.

    Data Science Course in Raipur

    ReplyDelete
  37. Great Post with valuable information. I am glad that I have visited this site. Share more updates.


    Jira online training
    Selenium Online Training
    salesforce course online

    ReplyDelete
  38. I have been searching to find a comfort or effective procedure to complete this process and I think this is the most suitable way to do it effectively. ExcelR Data Analyst Course

    ReplyDelete
  39. Good Post! it was so good to read and useful to improve my knowledge as an updated one, keep blogging. After seeing your article, I want to say that also a well-written article with some very good information which is very useful for the readers.... thanks for sharing it and do share more posts like this.
    Data Science Training in Hyderabad
    Data Science Course in Hyderabad

    ReplyDelete
  40. I was basically inspecting through the web filtering for certain data and ran over your blog. I am flabbergasted by the data that you have on this blog. It shows how well you welcome this subject. Bookmarked this page, will return for extra. data science course in jaipur

    ReplyDelete
  41. Extremely overall quite fascinating post. I was searching for this sort of data and delighted in perusing this one. Continue posting. A debt of gratitude is in order for sharing. data science institute in delhi

    ReplyDelete