SonarQube integration with Selenium Scripts

SonarQube integration with Selenium Scripts

In this blog, we are going to learn, what is SonarQube, how to integrate our selenium automation script or any other code with SonarQube for automatic Code Quality analysis and identify the different vulnerabilities.

What is SonarQube??

SonarQube is an open-source platform for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugscode smells, and security vulnerabilities. It also offers various reports on code coverage, complexity, coding practices as well as on duplicate code. SonarQube Supports 20+ Programming languages.

Please Note before starting further on this blog, I am assuming you have basic knowledge about maven, and it is already installed in the local machine as well as in your ide along with all other maven plugins to execute the test.

How to install SonarQube??

We Can download SonarQube from the official website of Sonar under the download section or directly using the below links.

To Start SonarQube

In SonarQube installation folder under the bin, depending on your OS version there would be file name StartSonar.bat click on that file.

In the command prompt we will be getting a message stating that “SonarQube is up”.

By default SonarQube runs on http://localhost:9000

Default username and password of SonarQube is admin.

Sometime it may also ask the user to generate token this is a completely optional step and could be skip.

Now let’s check out how we can integrate Selenium or any other project with SonarQube.

1)   Inside project POM.xml file add the below two plugins i.e maven Sonar Scanner and jacoco Plugin.

2)   Now from command prompt inside project go and execute code using
     mvn clean install sonar:sonar

3)   After Successful execution of your code refresh SonarQube Dashboard and we will get report.

To know how we can read the SonarQube Report, please Click on this link.

Please refer this blog on how to integrate SonarQube with Jenkins.

Keep Learning, Keep Sharing.



My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post
April 12, 2020 at 1:19 PM

Can elaborate a bit more about step-2

April 12, 2020 at 1:28 PM

Can you elaborate a bit more about step-2

June 12, 2020 at 6:23 PM

Thanks for sharing steps to integrate SonarQube with Selenium. We followed the steps and we successfully got the report but our report is showing Coverage as 0.0%. Any idea what has been missed.