{"id":25430465,"url":"https://github.com/bootstage/testkit-gradle-plugin","last_synced_at":"2025-10-31T20:30:21.397Z","repository":{"id":57731516,"uuid":"305858887","full_name":"bootstage/testkit-gradle-plugin","owner":"bootstage","description":"Testkit for Android gradle plugin testing","archived":false,"fork":false,"pushed_at":"2023-09-03T00:54:36.000Z","size":893,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-15T09:48:48.845Z","etag":null,"topics":["android","gradle","testkit"],"latest_commit_sha":null,"homepage":"https://testkit.bootstage.io","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bootstage.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2020-10-20T23:42:20.000Z","updated_at":"2023-10-17T17:47:33.000Z","dependencies_parsed_at":"2024-11-15T09:36:59.765Z","dependency_job_id":"adb65746-d0bc-41f9-a6d7-af080762acf1","html_url":"https://github.com/bootstage/testkit-gradle-plugin","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bootstage%2Ftestkit-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bootstage%2Ftestkit-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bootstage%2Ftestkit-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bootstage%2Ftestkit-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bootstage","download_url":"https://codeload.github.com/bootstage/testkit-gradle-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239228559,"owners_count":19603637,"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":["android","gradle","testkit"],"created_at":"2025-02-17T03:28:38.397Z","updated_at":"2025-10-31T20:30:21.346Z","avatar_url":"https://github.com/bootstage.png","language":"Kotlin","readme":"## Introduction\n\nAndroid developers might be use Android Gradle plugin's internal API to build custom gradle plugins for Android project, the idea is great, but the internal API of Android Gradle plugin is unstable, in fact, the internal API of each major release of Android Gradle plugin always has significant changes, It takes too much efforts on compatibility testing.\n\nThe goal of [testkit-gradle-plugin](https://plugins.gradle.org/plugin/io.bootstage.testkit) is to make the custom Android gradle plugin testing easier and more efficient\n\n## Getting Started\n\n### Create gradle project structure\n\nCreate Gradle project structure under Java resources directory\n\n```\nsrc/integrationTest/resources\n├── build.gradle\n└── src\n    └── main\n        └── java\n            └── main.kt\n```\n\n#### build.gradle\n\n```gradle\nplugins {\n    id 'org.jetbrains.kotlin.jvm' version '1.3.72'\n    id 'io.bootstage.testkit' version '1.3.0'\n}\n\nrepositories {\n    mavenLocal()\n    google()\n    mavenCentral()\n    jcenter()\n}\n\ndependencies {\n    implementation \"org.jetbrains.kotlin:kotlin-stdlib:1.3.72\"\n}\n\ncompileKotlin {\n    kotlinOptions {\n        jvmTarget = \"1.8\"\n    }\n}\n\ncompileTestKotlin {\n    kotlinOptions {\n        jvmTarget = \"1.8\"\n    }\n}\n\napply from: \"$rootDir/gradle/integration-test.gradle\"\n\n```\n\n### gradle/integration-test.gradle\n\n```gradle\nsourceSets {\n    integrationTest {\n        java {\n            srcDirs += []\n        }\n        kotlin {\n            srcDirs += ['src/integrationTest/kotlin', 'src/integrationTest/java']\n        }\n        resources.srcDir file('src/integrationTest/resources')\n        compileClasspath += sourceSets.main.output + configurations.testRuntime\n        runtimeClasspath += output + compileClasspath\n    }\n}\n\nconfigurations {\n    integrationTestImplementation.extendsFrom testImplementation\n    integrationTestRuntimeOnly.extendsFrom testRuntimeOnly\n}\n\ntask integrationTest(type: Test) {\n    description = 'Runs the integration tests.'\n    group = 'verification'\n    testClassesDirs = sourceSets.integrationTest.output.classesDirs\n    classpath = sourceSets.integrationTest.runtimeClasspath\n    mustRunAfter test\n}\n\ncheck.dependsOn integrationTest\n\ncompileIntegrationTestKotlin {\n    kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8\n}\n\ngradlePlugin {\n    testSourceSets sourceSets.integrationTest\n}\n```\n\n### Write test code\n\n```kotlin\nclass SimpleIntegrationTest {\n\n    private val projectDir: TemporaryFolder = TemporaryFolder()\n\n    @get:Rule\n    val chain: RuleChain = rule(projectDir) { projectDir -\u003e\n        GradleExecutor(projectDir::getRoot)\n    }\n\n    @Test\n    @Case(SimpleTestCase::class)\n    fun `test gradle build`() {\n        projectDir.copyFromResource(\"build.gradle\")\n        projectDir.copyFromResource(\"src\")\n    }\n\n}\n\nclass SimpleTestCase : TestCase {\n    override fun apply(project: Project) {\n        project.projectDir.walkTopDown().forEach(::println)\n    }\n}\n```\n\n### Run tests\n\nRunning test by executing the following command:\n\n```bash\n./gradlew cleanTest integrationTest\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbootstage%2Ftestkit-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbootstage%2Ftestkit-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbootstage%2Ftestkit-gradle-plugin/lists"}