Sonarcube using rspec not showing count of Unit Tests
Asked Answered
C

1

6

I'm using Sonarqube with RoR and RSpec as testing tools, successfully get coverage but not the count of Unit Tests as shown on the image below:

Sonarqube report

Please help 🙏🏼


Configuration:

spec_helper.rb

if Rails.env.development? || Rails.env.test?
  require 'simplecov'
  require 'simplecov-json'
  SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter
  SimpleCov.start
end

sonar-project.properties

sonar.projectKey=myapp
sonar.sources=.
sonar.exclusions=**/vendor/**,**/coverage/**,**/assets/**
sonar.tests=app-code/spec
sonar.test.inclusions=**/*_spec.rb
sonar.test.exclusions=**/vendor/**
sonar.ruby.coverage.reportPaths=app-code/coverage/.resultset.json
sonar.ruby.coverage.framework=RSpec

Gemfile

  gem 'simplecov', '>= 0.17', '< 0.18'
  gem 'simplecov-json', '<= 0.2'
Culbreth answered 23/6, 2020 at 10:19 Comment(2)
Did you find a way? It's a shame, I can see so many people having issues with Sonar/Ruby and no one caresApical
@Apical nopeCulbreth
B
1

The simplecov is only used for coverage metrics. Unfortunately the is no native Ruby plugin that you can use to create a unit test count report, but you can use a sonar.testExecutionReportPaths parameter with generic report. I've used this formater for it.

sonar.testExecutionReportPaths=./path-to-your/report.xml 
Bernadine answered 17/12, 2021 at 14:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.