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

Create separate report for each Gradle test task #704

Closed
aansari15 opened this issue Nov 15, 2024 · 2 comments
Closed

Create separate report for each Gradle test task #704

aansari15 opened this issue Nov 15, 2024 · 2 comments
Assignees
Labels
Feature Feature request issue type S: waiting for clarification Status: additional information required to proceed

Comments

@aansari15
Copy link

What is your use-case and why do you need this feature?
We currently have two Gradle tasks - test and integrationTest. These test tasks run in separate steps in our CI workflow. My use case is to generate a Kover report for each of these CI steps and upload them to Codecov. It should basically look like so:

  • unit_tests CI step:
    • Run unit tests and generate coverage report from unit tests only
    • Upload this coverage report to Codecov
  • integration_tests CI step
    • Run integration tests and generate coverage report from integration tests only
    • Upload this coverage report to Codecov

Describe the solution you'd like
I know that disabledForTestTasks.add("integrationTest") exists, but what I would like is to conditionally enable/disable coverage from a test task. So disable integrationTest when running the unit_tests CI step, and similarly disable test when running the integration_tests CI step

@aansari15 aansari15 added Feature Feature request issue type S: untriaged Status: issue reported but unprocessed labels Nov 15, 2024
@shanshin
Copy link
Collaborator

Hi,
for your case, you can make conditional inclusion of tests depending on the passed parameters.

e.g. if you add build script

kover {
    currentProject {
        instrumentation {

            if (hasProperty("unit_tests")) {
                disabledForTestTasks.add("integrationTest")
            }

            if (hasProperty("integration_tests")) {
                disabledForTestTasks.add("test")
            }
            
        }
    }
}

you may specify parameters in different CI builds: -Punit_tests or -Pintegration_tests

@shanshin shanshin added S: waiting for clarification Status: additional information required to proceed and removed S: untriaged Status: issue reported but unprocessed labels Nov 19, 2024
@aansari15
Copy link
Author

@shanshin thanks for the suggestion, works just as expected!

It could be worthwhile to add this to the official documentation as well, to help out others who may not be very well-versed with Gradle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Feature request issue type S: waiting for clarification Status: additional information required to proceed
Projects
None yet
Development

No branches or pull requests

2 participants