Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running check task in a subproject runs all check test tasks in all project #114

Closed
JavierSegoviaCordoba opened this issue Jan 4, 2022 · 7 comments

Comments

@JavierSegoviaCordoba
Copy link

JavierSegoviaCordoba commented Jan 4, 2022

With Kover enabled if I run ./gradlew some-project:check --dry-run implies running multiple tasks in other projects (looks like any test task in other non-dependant projects is executed).

Disabling Kover and rerunning the previous task fix the issue, so Kover is binding all projects in some way.

./gradlew some-project:koverHtmlProjectReport --dry-run has this issue too, so I think all kover tasks have this problem.

@shanshin
Copy link
Collaborator

In the next release, the API will be redesigned, the launch of all tests will be enabled with a separate flag.
In the case when the number of projects is small and the tests actively use classes from other projects, the only way to collect full coverage is to run all the tests.

However, in general, this is not very convenient, because tests do not always use classes from other projects and running all tests takes too long.

@JavierSegoviaCordoba
Copy link
Author

Personally if I have kover enabled to recollect all tests coverage in the root module, I would expect that if I run the tests for a specific project, that the coverage was not created, or in other words, kover shouldn't be executed.

I understand it is difficult/impossible to get coverage without running all test tasks for all modules, but the previous behavior should be "easily" implemented.

The flag you mentioned would do what I said?

@shanshin
Copy link
Collaborator

In the next release, a report for a specific project will be built only on the basis of tests of this project.

To change this behavior, you will need to explicitly add a dependency on another project, the tests of which should be performed before generating the report (or verification).

It is impossible to rely on the implicit order of calling test tasks in the command line, because this will complicate the use of the cache and may lead to unpredictable results.

@JavierSegoviaCordoba
Copy link
Author

That is perfect if only projects depending among them are the only test tasks executed and non dependent projects are just skipped.

Is there any place to check the roadmap for Kover and some ETAs?

@shanshin
Copy link
Collaborator

shanshin commented Jan 11, 2022

That is perfect if only projects depending among them are the only test tasks executed and non dependent projects are just skipped.

The exact finding of the projects of which classes fall into the test classpath may not be such a trivial task for all target platforms (Java, Kotlin JVM, Kotlin Multi-Platform, Android).

Complicating the search is the fact that classes can be used in test tasks bypassing project dependencies (see
org.gradle.api.task.testing.Test#setClasspath). Of course, this is a rare case, but it is necessary to carefully study such cases for all supported compilers and platforms - it can take a long time.

@shanshin
Copy link
Collaborator

Please try 0.5.0-RC2.
Be careful, the tasks have been renamed compared to 0.5.0-RC.

@JavierSegoviaCordoba
Copy link
Author

It is fixed, god job 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants