Tuesday, July 24, 2018

Configuring Jenkins with MSSQL server.


  • Need to install SQL server.
  • Install Java.
  • SQL server is with SQL authentication method.

Below is the sonar config looks like ,But im getting an error.


sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=SonarQube;instanceName=SQLEXPRESS
sonar.jdbc.username=sonarqube
sonar.jdbc.password=mypassword

java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').


Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL 'jdbc:sqlserver:localhostSQLEXPRESS;databaseName=SonarQube;instanceName=SQLEXPRESS;selectMethod=cursor;'

Full post:
http://blog.majcica.com/2016/04/28/sonarqube-on-windows-and-ms-sql/

Wednesday, July 11, 2018

Show MSTest coverage on a .net project - Sonar

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Dynami
c Code Coverage Tools>CodeCoverage.exe 
collect /output:VisualStudio.coverage "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "C:\Program Files (x86)\Jenkins\workspace\dash_\dash\ReportShare\bin\ReportShare.dll"



  1. You have to find the CodeCoverage.exe installation location.

In my PC its inside "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Dynami
c Code Coverage Tools>"

  2.Execute your MSTest dll file by pointing it to CodeCoverage.exe

     3. Then VisualStudio.coverage file will be generate on your CodeCoverage.exe's file location.



C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Dynami
c Code Coverage Tools>CodeCoverage.exe analyze /output:VisualStudio.coveragexml VisualStudio.coverage

  
  4.By pointing to the same CodeCoverage.exe generate the coveragexml file.

     5. Then VisualStudio.coveragexml file will be generate on your CodeCoverage.exe's file           location.




sonar.cs.vscoveragexml.reportsPaths=C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Team Tools/Dynamic Code Coverage Tools/VisualStudio.coveragexml

   6.Then add sonar.cs.vscoveragexml.reportsPaths parameter to your sonar analysis properties and point the newly generated  VisualStudio.coveragexml  file to that property.




DONE!