Hi! I’m looking for a framework that I could use o...
# code-coverage
r
Hi! I’m looking for a framework that I could use on Gitlab runner to check the code coverage for a multi-module project. For me the most important is to see the result of all modules combined. Which framework would You recommend?
c
Do you want coverage reporting or coverage visualization (also called coverage reports)?
r
Reporting seems the one
c
With Kover ; in each
build.gradle.kts
Copy code
plugins {
    id("org.jetbrains.kotlinx.kover") 
}

kover {
	reports {
		verify {
			rule {
				disabled = false
				groupBy = GroupingEntityType.APPLICATION

				bound {
					coverageUnits = CoverageUnit.BRANCH
					minValue = 80
				}
			}
		}
	}
}
in the root build.gradle.kts:
Copy code
plugins {
    id("org.jetbrains.kotlinx.kover") 
}

dependencies {
    kover(project("your-first-module"))
    kover(project("your-second-module"))
    // …
}
then when you run your tests;
Copy code
your-job:
  image: …
  script: 
    - ./gradlew check :koverVerify :koverHtmlReport :koverLog
  after_script:
    - mkdir -p jvm-cover-report
    - mv build/reports/kover/html/* jvm-cover-report
  coverage: '/application line coverage: (\d+\.?\d*%)/'
  artifacts:
    paths:
      - jvm-cover-report
    expose_as: JVM code coverage
👍 1
I think that's all you need but I've done my setup a long time ago so maybe I'm forgetting something
r
Wow, thank You! 🙇 I managed to implement the Kover in my project, but was not able to do the CI part as wanted. Will take a look on Your solution! 🤝