# How to sonar testcoverage
## Go
1) add
`- run: go mod download`
`- run: go generate`
`- name: Unit Tests with Coverage`
`run: go test -coverprofile=coverage.out ./...`
to `sonarqube-build.yml`
---
## Spring Boot
1) add `run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=chickenshock-backend -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml` to `sonarqube-build.yml`
1) add
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
to `pom.xml`
1) to test database add
# Service containers to run with runner-job
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: [DB_PW_HERE]
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
between `runs-on: self-hosted` and `steps` to `sonarqube-build.yml`
## Vue
1) add