{"id":31925508,"url":"https://github.com/mirko-felice/gradle-plugin-testkit","last_synced_at":"2025-10-14T01:02:24.227Z","repository":{"id":158730473,"uuid":"634173598","full_name":"mirko-felice/gradle-plugin-testkit","owner":"mirko-felice","description":"Testing library to help users test gradle plugins.","archived":false,"fork":false,"pushed_at":"2025-08-21T23:54:58.000Z","size":642,"stargazers_count":0,"open_issues_count":10,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-22T01:28:55.328Z","etag":null,"topics":["gradle-plugin","testing","testkit"],"latest_commit_sha":null,"homepage":"","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/mirko-felice.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,"zenodo":null}},"created_at":"2023-04-29T09:27:28.000Z","updated_at":"2023-06-01T09:25:49.000Z","dependencies_parsed_at":"2024-02-09T02:30:07.274Z","dependency_job_id":"01c22dce-de7f-4a84-b145-0e32c79b52a5","html_url":"https://github.com/mirko-felice/gradle-plugin-testkit","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/mirko-felice/gradle-plugin-testkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirko-felice%2Fgradle-plugin-testkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirko-felice%2Fgradle-plugin-testkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirko-felice%2Fgradle-plugin-testkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirko-felice%2Fgradle-plugin-testkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mirko-felice","download_url":"https://codeload.github.com/mirko-felice/gradle-plugin-testkit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirko-felice%2Fgradle-plugin-testkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017436,"owners_count":26086079,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["gradle-plugin","testing","testkit"],"created_at":"2025-10-14T01:00:32.425Z","updated_at":"2025-10-14T01:02:24.221Z","avatar_url":"https://github.com/mirko-felice.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gradle Plugin Testkit\n\n### Code Quality\n\n[![CI + CD](https://github.com/mirko-felice/gradle-plugin-testkit/actions/workflows/ci-and-cd.yml/badge.svg)](https://github.com/mirko-felice/gradle-plugin-testkit/actions/workflows/ci-and-cd.yml)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=mirko-felice_gradle-plugin-testkit\u0026metric=security_rating)](https://sonarcloud.io/summary/overall?id=mirko-felice_gradle-plugin-testkit)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=mirko-felice_gradle-plugin-testkit\u0026metric=bugs)](https://sonarcloud.io/summary/overall?id=mirko-felice_gradle-plugin-testkit)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=mirko-felice_gradle-plugin-testkit\u0026metric=code_smells)](https://sonarcloud.io/summary/overall?id=mirko-felice_gradle-plugin-testkit)\n[![codecov](https://codecov.io/gh/mirko-felice/gradle-plugin-testkit/branch/master/graph/badge.svg?token=TCU6QY2RD5)](https://codecov.io/gh/mirko-felice/gradle-plugin-testkit)\n\n### Modules\n\n[![Latest Maven Core Release](https://img.shields.io/maven-central/v/io.github.mirko-felice.testkit/core?label=core\u0026logo=apachemaven)](https://central.sonatype.com/artifact/io.github.mirko-felice.testkit/core)\n[![Latest Gradle Plugin Release](https://img.shields.io/gradle-plugin-portal/v/io.github.mirko-felice.testkit?color=blue\u0026label=gradle-plugin\u0026logo=gradle)](https://plugins.gradle.org/plugin/io.github.mirko-felice.testkit)\n#### Relative docs\n\n[![Latest Core Doc](https://javadoc.io/badge2/io.github.mirko-felice.testkit/core/javadoc.svg?label=core-doc)](https://javadoc.io/doc/io.github.mirko-felice.testkit/core)\n[![Latest Gradle Plugin Doc](https://javadoc.io/badge2/io.github.mirko-felice.testkit/gradle-plugin/javadoc.svg?label=gradle-plugin-doc)](https://javadoc.io/doc/io.github.mirko-felice.testkit/gradle-plugin)\n\n## Core\n\n### Purpose\n\nThis library aims to help users to test own Gradle plugins, providing a declarative way\nto do that.\n\n### Usage\n\nThis library provides one main _API_: [`Testkit`](https://github.com/mirko-felice/gradle-plugin-testkit/blob/master/core/src/main/kotlin/io/github/mirkofelice/api/Testkit.kt).\n\nIt can be used in your own tests like below.\n\n```kotlin\nclass ExampleTest : StringSpec({\n    \n    \"Example Test\" {\n        Testkit.test(projectName)\n    }   \n})\n```\n\nIt uses **_yaml_** files to declare the tests. More info [below](#yaml-structure).\n\nIt uses a [`CheckerType`](https://github.com/mirko-felice/gradle-plugin-testkit/blob/master/src/main/kotlin/io/github/mirkofelice/api/CheckerType.kt) \nto know which subclass of [`TestkitChecker`](https://github.com/mirko-felice/gradle-plugin-testkit/blob/master/core/src/main/kotlin/io/github/mirkofelice/checkers/TestkitChecker.kt)\nuse to apply the various checks.\n\nAt the moment the project provides these types of checker:\n\n- **KOTLIN**: refers to the [`KotlinChecker`](https://github.com/mirko-felice/gradle-plugin-testkit/blob/master/core/src/main/kotlin/io/github/mirkofelice/checkers/KotlinChecker.kt)\n  which uses the basic Kotlin assertions.\n\n#### Configuration\n\nThe core function `test()` provides four parameters to give the user the capability to \nconfigure the feature.\n\n- **projectName**: parameter describing the name of the project used to search for plugin classpath.\n\n- **projectFolderPath**: parameter describing the path of the folder containing the _yaml_ file.\n  Default to `currentDirectory/src/main/resources/`.\n\n- **checkerType**: parameter describing the _CheckerType_ to use.\\\n  Default to `CheckerType.KOTLIN`.\n\n- **forwardOutput**: parameter describing if the user wants to see the Gradle build output or not.\\\n  Default to `false`.\n\n#### Yaml Structure\n\nYaml files have to be structured in a specific way.\n\nBelow there is a complete example.\n\n```yaml\ntests:\n  - description: \"Example description\"\n    id: uniqueIdentifier\n    requires: idOfAnotherTest\n    configuration:\n      tasks:\n        - task1\n        - task2\n        - task3\n      options:\n        - option1\n        - option2\n    expectation:\n      result: success\n      outcomes:\n        success:\n          - successTask\n        failed:\n          - failedTask\n        upToDate:\n          - upToDateTask\n        skipped:\n          - skippedTask\n        fromCache:\n          - fromCacheTask\n        noSource:\n          - noSourceTask\n        notExecuted:\n          - notExecutedTask\n      output:\n        contains:\n          - firstPartialOutput\n          - secondPartialOutput\n        doesntContain:\n          - firstPartialOutput\n          - secondPartialOutput\n      files:\n        existing:\n          - name: \"test.txt\"\n            content: \"Example content\"\n            permissions:\n              - R\n              - W\n              - X\n            contentRegex: \"$regex\"\n```\n\n#### Class diagrams\n\n[![PlantUML core class diagram](https://shorturl.at/dlqEV)](https://shorturl.at/fsTU4)\n\n[![PlantUML plugin class diagram](https://shorturl.at/otzP6)](https://shorturl.at/qEHLY)\n\n## Gradle-Plugin\n\n### Usage\n\nTo facilitate the user to use this library, a Gradle Plugin has been created.\n\n#### Apply\n\nIn order to use the plugin, you should apply it in your `build.gradle.kts`.\n\n```kotlin\nplugins {\n    id(\"io.github.mirko-felice.testkit\") version \"\u003cx.y.z\u003e\"\n}\n```\n\nIf not already applied, this plugin automatically applies [`java-gradle-plugin`](https://docs.gradle.org/current/userguide/java_gradle_plugin.html).\n\n#### Configuration\n\nTo configure the plugin you can use the extension like below.\n\n```kotlin\ntestkit {\n    checkerType.set(CheckerType.KOTLIN)\n    forwardOutput.set(true)\n    folders {\n        withMainDefault()\n        withTestDefault()\n        projectFolder(\"path/to/yaml\")\n    }\n    tests {\n        folder = file(\"path/to/folder\")\n        test(\"description\") {\n            ...\n        }\n    }\n}\n```\n\nThe plugin provides a set of properties/methods, using two main DSL.\n\n##### Required\n\nNo required property/method. That means no tests will be run.\n\n##### Optional\n\nTwo main properties:\n\n- **checkerType**: property describing the _CheckerType_ to use for **ALL** tests.\\\n  Default to `CheckerType.KOTLIN`.\n\n- **forwardOutput**: property describing if the user wants to see the Gradle build output or not.\\\n  Default to `false`.\\\n  **_BE CAREFUL_**: even if this is set to `true`, you should run the task with the\n  appropriate option _-q_, in order to get the output sorted correctly.\\\n  Example: `./gradlew testkit -q`\n\nUsing the folder DSL, folders can be added inside `folders { }` block:\n\n- **withMainDefault()**: method to add the sub-folders into the default main path (_src/main/resources_).\n\n- **withTestDefault()**: method to add the sub-folders into the default test path (_src/test/resources_).\n\n- **projectFolder(path: String)**: method to add a folder with the given path, always starting from the project directory.\n\n- **genericFolder(path: String)**: method to add a folder with the given path, can be located anywhere.\n\n- **subFoldersOfProject(path: String)**: method to add all the sub-folders in the given path, always starting from the project directory.\n\n- **subFoldersOf(path: String)**: method to add all the sub-folders in the given path, can be located anywhere.\n\nThese folders must contain the _yaml_ file and the _build.gradle.kts_.\n\nUsing the test DSL, tests can be created inside `tests { }` block:\n\n- **folder**: property to set the root folder containing the _build.gradle.kts_, always starting from the project directory.\n\n- **test(description: String) { }**: method to add a new test with the given description, followed by its configuration.\n  This provides a full DSL to mirror the yaml structure.\n\n#### Tasks\n\nThis plugin creates the following tasks:\n\n- **testkitFolders**: task able to run the testkit library using the _folder_ DSL configuration.\n\n- **testkitDSL**: task able to run the testkit library using the _test_ DSL configuration.\n\n- **testkit**: global task to execute all the testkit tasks.\n\n## License\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fmirko-felice%2Fgradle-plugin-testkit-core.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fmirko-felice%2Fgradle-plugin-testkit-core)\n\nLicensed under the [MIT License](LICENSE).\n\n### License Compliance\n\n\u003cdiv\u003e\nThis project uses \u003ccode\u003enpm\u003c/code\u003e to perform\n\n\u003ca href=\"https://github.com/semantic-release/semantic-release\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release\" \n      style=\"vertical-align:middle\" alt=\"semantic-release: angular\"/\u003e\n\u003c/a\u003e\nand does not modify its source code, so following authors' credits:\n\n- `npm` created by The Perl Foundation \u003chttps://www.perlfoundation.org/\u003e, licensed\n  under an Artistic-2.0 \u003chttps://opensource.org/licenses/Artistic-2.0\u003e\n- `glob`'s logo created by Tanya Brassie \u003chttp://tanyabrassie.com/\u003e, licensed\n  under a Creative Commons Attribution-ShareAlike 4.0 International License\n  \u003chttps://creativecommons.org/licenses/by-sa/4.0/\u003e with copyright notice -\u003e\n  'Copyright (c) 2009-2022 Isaac Z. Schlueter and Contributors'\n- `spdx-exceptions` created by Kyle E. Mitchell \u003chttps://kemitchell.com/\u003e, licensed\n  under a Creative Commons Attribution 3.0 \u003chttps://creativecommons.org/licenses/by/3.0/\u003e\n- `diff` uses [IPA Font License](licenses/IPA%20Font%20License%20(IPA))\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirko-felice%2Fgradle-plugin-testkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmirko-felice%2Fgradle-plugin-testkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirko-felice%2Fgradle-plugin-testkit/lists"}