{"id":16870553,"url":"https://github.com/koral--/jacoco-gradle-testkit-plugin","last_synced_at":"2025-03-22T07:31:02.601Z","repository":{"id":19141187,"uuid":"86018593","full_name":"koral--/jacoco-gradle-testkit-plugin","owner":"koral--","description":"Gradle plugin for JaCoCo code coverage in tests using Gradle TestKit","archived":false,"fork":false,"pushed_at":"2023-05-04T10:54:20.000Z","size":302,"stargazers_count":43,"open_issues_count":4,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-14T15:04:39.716Z","etag":null,"topics":["coverage","gradle-plugin","gradle-testkit","hacktoberfest","jacoco","jacoco-plugin","testkit"],"latest_commit_sha":null,"homepage":"https://www.thedroidsonroids.com/blog/how-to-create-gradle-plugin-in-kotlin/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koral--.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-24T02:28:03.000Z","updated_at":"2024-06-29T02:54:17.000Z","dependencies_parsed_at":"2024-10-28T12:47:13.975Z","dependency_job_id":null,"html_url":"https://github.com/koral--/jacoco-gradle-testkit-plugin","commit_stats":{"total_commits":58,"total_committers":7,"mean_commits":8.285714285714286,"dds":"0.27586206896551724","last_synced_commit":"b5cd84892daf33f61d956600e79dbe233d19c2bf"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koral--%2Fjacoco-gradle-testkit-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koral--%2Fjacoco-gradle-testkit-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koral--%2Fjacoco-gradle-testkit-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koral--%2Fjacoco-gradle-testkit-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koral--","download_url":"https://codeload.github.com/koral--/jacoco-gradle-testkit-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244925001,"owners_count":20532873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coverage","gradle-plugin","gradle-testkit","hacktoberfest","jacoco","jacoco-plugin","testkit"],"created_at":"2024-10-13T15:04:44.092Z","updated_at":"2025-03-22T07:30:58.840Z","avatar_url":"https://github.com/koral--.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![AppVeyor](https://ci.appveyor.com/api/projects/status/pvd82vx2koufk4u5/branch/master?svg=true)](https://ci.appveyor.com/project/koral--/jacoco-gradle-testkit-plugin/branch/master)\n[![codecov](https://codecov.io/gh/koral--/jacoco-gradle-testkit-plugin/branch/master/graph/badge.svg)](https://codecov.io/gh/koral--/jacoco-gradle-testkit-plugin)\n[![Build Status](https://app.bitrise.io/app/8be2125eb039c87e/status.svg?token=ZWi1ISNfiK0LCZ7Bk5g_TA\u0026branch=master)](https://app.bitrise.io/app/8be2125eb039c87e)\n\n# jacoco-gradle-testkit-plugin\nGradle plugin for [JaCoCo](http://www.eclemma.org/jacoco/) code coverage\nin tests using [Gradle TestKit](https://docs.gradle.org/current/userguide/test_kit.html).\n\n## Motivation\nThere is no built-it support for code coverage in TestKit. Those tests run\nin separate JVM and configuration of [JaCoCo plugin](https://docs.gradle.org/current/userguide/jacoco_plugin.html)\nis not taken into account. See [Gradle forum post](https://discuss.gradle.org/t/gradle-plugins-integration-tests-code-coverage-with-jacoco-plugin/12403)\nfor more details.\n\n## Usage\n- Apply plugin in `build.gradle`:\n```groovy\nplugins {\n  id \"pl.droidsonroids.jacoco.testkit\" version \"1.0.12\"\n}\n```\nThis will add `testkit-gradle.properties` system resource.\n\n- Create `gradle.properties` file used by `GradleRunner` and populate it\nwith content from mentioned resource.\nSample kotlin code:\n```kotlin\nclass AwesomeTest {\n\n    fun InputStream.toFile(file: File) {\n        use { input -\u003e\n            file.outputStream().use { input.copyTo(it) }\n        }\n    }\n\n    fun GradleRunner.withJaCoCo(): GradleRunner {\n        javaClass.classLoader.getResourceAsStream(\"testkit-gradle.properties\").toFile(File(projectDir, \"gradle.properties\"))\n        return this\n    }\n\n    @get:Rule\n    val temporaryFolder = TemporaryProjectFolder()\n\n    @Test\n    fun `empty project builds successfuly`() {\n        val result = GradleRunner.create()\n                .withProjectDir(temporaryFolder.root)\n                .withTestKitDir(temporaryFolder.newFolder())\n                .withPluginClasspath()\n                .withJaCoCo()\n                .build()\n    }\n}\n```\n\n### Adding coverage for another task (ex. integrationTest)\nBy default the plugin configures the `test` task for any project with Java plugin applied.\n\nTo configure the coverage for another task just add something like this:\n```groovy\njacocoTestKit {\n    applyTo(\"intTestRuntimeOnly\", tasks.named(\"integrationTest\"))\n}\n```\n\n### Custom JaCoCo destination file\nJaCoCo destination file path reads it from the `JacocoTaskExtension` so you can change it like this:\n```groovy\ntasks.named(\"test\").configure {\n    jacoco {\n        destinationFile = file('integration.exec')\n    }\n}\n```\n\n### Requirements\nMinimum supported versions:\n- Gradle: **7.6**\n- Java: **1.8**\n\n### Backwards compatibility\n\n#### Migrating from 1.0.9 or older\n\nStarting from version 1.0.10 the legacy plugin coordinates have changed. For example:\n\n```\nclasspath(\"gradle.plugin.pl.droidsonroids.gradle.jacoco:jacoco-gradle-testkit-plugin:1.0.9\")\n```\n\nbecame:\n\n```\nclasspath(\"pl.droidsonroids.gradle.jacoco:pl.droidsonroids.gradle.jacoco:1.0.10\")\n```\n\nNote the `gradle.plugin` prefix has gone. This change does NOT affect the plugins DSL:\n\n```\nplugins {\n  id(\"pl.droidsonroids.jacoco.testkit\") version \"1.0.10\"\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoral--%2Fjacoco-gradle-testkit-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoral--%2Fjacoco-gradle-testkit-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoral--%2Fjacoco-gradle-testkit-plugin/lists"}