jean
09/25/2025, 8:12 AMCLOVIS
09/26/2025, 8:39 AMif (foo) {
println("a")
println("b")
}
Here, there are 3 lines and 1 branch (the entire if)
foo?.bar ?: return "foo"
Here, there is 1 line and 3 branches (everything not null, foo is null, bar is null)CLOVIS
09/26/2025, 8:41 AMAre private functions took in account for the total of testable code for example?Yes
If yes, should I make them intern so I can test them?No. If a test calls a public function, and that public function calls the private function, then the private function is marked as covered. If the private function is marked as uncovered, that means not a single test went through it, even through public functions. That either means you don't test the public functions, or the private function is dead code.
jean
09/26/2025, 8:44 AMCLOVIS
09/26/2025, 8:52 AMjean
09/26/2025, 9:26 AMCLOVIS
09/26/2025, 9:32 AMCLOVIS
09/26/2025, 9:33 AMtest {
mock fooService.create() → Foo("foo")
assert fooService.create() == Foo("foo")
}
This tests literally none of your codebase, at all, but it's surprisingly common to find in mocked codebasesjean
09/26/2025, 10:07 AMjean
09/26/2025, 11:38 AMreports.filters.excludes {
annotatedBy("androidx.room.*")
annotatedBy("*Composable")
annotatedBy("*Preview")
annotatedBy("*Generated")
annotatedBy("org.junit.jupiter.api.Test")
}
But it doesn’t work. All the class annotated with @Generated
are still picked up. Do you know how I can prevent Kover of checking them?CLOVIS
09/26/2025, 12:57 PM