https://kotlinlang.org logo
#kotest
Title
# kotest
m

Marc

03/29/2023, 8:48 AM
not kotest 100% related but
Kover
. Does anyone know how to set up configuration in order run tests each time a coverage report task is called?
e

Emil Kantis

03/29/2023, 8:51 AM
I think you could do something like
Copy code
tasks.withType<KoverReportTask>().configureEach {
   dependsOn(tasks.named("test"))
}
but I would ask in #gradle
j

Javier

03/29/2023, 8:54 AM
Kover tasks are already set to run if you run the test task. Which is the use case to do the reversed flow?
m

Marc

03/29/2023, 8:55 AM
oh nice! well I didn’t know that. In that case I wouldn’t need to do so 😄
j

Javier

03/29/2023, 8:57 AM
Anyway I would check it with dry run and 0.7.0 alpha, as I haven’t checked if it will do the same with the new huge refactor
t

thanksforallthefish

03/29/2023, 9:14 AM
Kover tasks are already set to run if you run the test task. Which is the use case to do the reversed flow?
really? I was thinking of looking at moving from jacoco to kover because jacoco is not very precise with kotlin code, but I don’t think it’s right to run coverage every time you run tests. at least, I don’t think it’s common to run all tests all the time, that is more CI job, but if you don’t run all the tests coverage is just a waste of time
m

Marc

03/29/2023, 9:15 AM
I asume that this is somehow configurable, can’t ensure tho
j

Javier

03/29/2023, 9:16 AM
Gradle allow disabling tasks easily, so it is easy to disable that behavior
t

thanksforallthefish

03/29/2023, 9:16 AM
disclaimer: I did not start to look into anything yet 😄
m

Marc

03/29/2023, 9:17 AM
I just tryed new kover 0.7, way easier to config
j

Javier

03/29/2023, 9:17 AM
anyway I think it doesn’t consume a lot of time
could you run
./gradlew test —dry-run
so we can check if that behavior is preserved?
m

Marc

03/29/2023, 9:20 AM
this is the only
kover
related task in the output:
Copy code
:feature:widgets:koverFindJar SKIPPED
but well eveything is
SKIPPED
IDKW
j

Javier

03/29/2023, 9:22 AM
dry run is to know which tasks would run
but they are skipped
mmm looks like it is not running kover I think. Could you clean the reports and run test? Maybe kover runs only with check task 🤔
m

Marc

03/29/2023, 9:24 AM
Ok let me try to clean everything and re-run
same output (sorry for the late response)
j

Javier

03/29/2023, 10:18 AM
but without dry run
the reports are generated?
m

Marc

03/29/2023, 10:27 AM
I doesn’t I had to generate them manually
I mean, by calling the gradle task
j

Javier

03/29/2023, 10:45 AM
you mean you need to call the kover task manually, right?
then you should use the @Emil Kantis approach
m

Marc

03/29/2023, 11:28 AM
KoverReportTask
not present 😕
e

Emil Kantis

03/29/2023, 11:31 AM
Oh, I'm using Kover 0.6.x. Maybe it's changed name
j

Javier

03/29/2023, 11:34 AM
they renamed a lot of things in 0.7.0
you have to check the migration guideline, maybe they mention it
m

Marc

03/29/2023, 12:01 PM
wait a second
I figured out that xml reports are skipped when calling task manually but html ones are generated
Copy code
> Task :feature:widgets:koverXmlReportDevelopDebug SKIPPED
Task 'koverXmlReportDevelopDebug' will be skipped because no tests were executed
'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin
j

Javier

03/29/2023, 12:03 PM
tbh I haven’t used kover with android, so I am not sure about the behavior of kover on that land
41 Views