{"id":23205715,"url":"https://github.com/big-guy/sample-custom-test-task","last_synced_at":"2025-09-04T19:20:39.295Z","repository":{"id":267569781,"uuid":"901662737","full_name":"big-guy/sample-custom-test-task","owner":"big-guy","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-21T20:53:35.000Z","size":9722,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T10:41:51.910Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/big-guy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-12-11T04:46:04.000Z","updated_at":"2025-02-21T20:53:38.000Z","dependencies_parsed_at":"2025-02-10T21:30:32.380Z","dependency_job_id":"32911774-93c1-4725-8b86-76ff56c500c3","html_url":"https://github.com/big-guy/sample-custom-test-task","commit_stats":null,"previous_names":["big-guy/sample-custom-test-task"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/big-guy/sample-custom-test-task","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/big-guy%2Fsample-custom-test-task","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/big-guy%2Fsample-custom-test-task/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/big-guy%2Fsample-custom-test-task/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/big-guy%2Fsample-custom-test-task/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/big-guy","download_url":"https://codeload.github.com/big-guy/sample-custom-test-task/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/big-guy%2Fsample-custom-test-task/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271867717,"owners_count":24836499,"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-08-24T02:00:11.135Z","response_time":111,"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":[],"created_at":"2024-12-18T16:39:44.545Z","updated_at":"2025-08-24T12:47:44.293Z","avatar_url":"https://github.com/big-guy.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"This sample shows how to create a plugin with a custom task that generates test events like the built-in `Test` task for JVM-based tests.\nThe plugin is packaged via an included build.\n\nThis sample is intended to demonstrate how a platform provider, like Android or Kotlin Multiplatform, would use a low-level API to generate test events.\n\nThis sample contains multiple parts.\n\nDemonstrating custom test tasks using the Gradle Tooling API and the new test event reporter API:\n\n* The `custom-test` plugin, which defines a custom task that generates test events.\n* The `consumer` build, which creates a Tooling API client to receive the test events.\n\nDemonstrating test report aggregation across projects:\n\n* The `application` build, which represents an application written in an example \"custom\" ecosystem.\n* The `library` build, which simulates an dependency of the application in the \"custom\" ecosystem.\n* The `aggregation` build, which demonstrates custom test report aggregration across projects.\n\nNOTE: The `consumer` requires Java 21.\n\n### Command-line interactions\n\nRun `gradle testPassingDebug` to run the custom test task. By default, no tests will fail and nothing will appear in the console log.\n\nRun `gradle testFailingDebug` to run the custom test task with failing tests. The console log will show the test events.\n\nLike the regular `Test` task, Gradle will produce an HTML report for each task. If tests fail, the link to the report will be part of the failure message.\n\nWhen running multiple tasks that emit test events, Gradle will also produce an aggregated report with results from all tasks.\n\nRun `gradle testFailingDebug testFailingRelease` to see this in action.\nThis should produce a clickable link to: `build/reports/aggregate-test-results/index.html`\n\n### Tooling API interactions\n\nRun `gradle :consumer:run` to run the Tooling API client. The client will run `gradle testPassingDebug testFailingDebug`, like above and print out any received test events.\n\nTwo types of events are captured:\n\n* A `TestFinishEvent` that is generated by tasks that use the new test event reporter API as well as the existing `Test` task.\n* A `TestMetadataEvent` that is generated by tasks that use the new test event reporter API. Eventually, the `Test` task will be able to generate these too.\n\nThe `TestMetadataEvent` includes custom metadata added by the task. These can be emitted any time between the start and end of a test or group of tests.\nThe custom metadata is represented by a map of key-value pairs (`String` to `Object`). Only serializable values are supported.\n\n### Metadata Reporting\n\nMetadata of various types is recorded during test execution and is available in the test reports located in `build/reports/tests`.\nThere are various types of metadata associated with at the root level, the test suite level and the individual test level.  Known types can be rendered with custom styles in the HTML report; for example, URI metadata is rendered as clickable links.\nRunning the failing tests, clicking the generated link, and investigating `MyTestSuite` is the easiest way to see this in action.\n\n### Custom test suites\n\nThe custom-test plugin shows a simple \"custom\" ecosystem that uses test suites with multiple test suite targets and a custom test task.\n\nFor demonstration purposes, it also includes a custom application and custom library as stand-ins for Android applications and Android libraries.\n\n### Test aggregation\n\nThe test aggregation plugin has been updated to support non-JVM test suites and their targets.\n\nWhen applied to a project with an application, the aggregation plugin will attempt to aggregate test results for each test suite from all projects that the current project depends on.\nThis is determined by looking at the runtimeElements of the current project and following its dependencies and selecting the test results from like-named test suites in other projects.\nYou can see this in `application/build.gradle.kts`.\n\nWhen applied to a subproject on its own, you need to explicitly list the projects you want to have aggregated and create aggregate reports manually.\nYou can see this in `aggregation/build.gradle.kts`.\n\n### Final notes\n\nIf this sample is imported into IntelliJ, the IDE will automatically show the test UI pane when running the `testPassingDebug`, `testFailingDebug`, `testPassingRelease` and `testFailingRelease` tasks. Custom test tasks are not automatically supported in the IDE yet, so this is accomplished by setting an internal flag on the custom tasks.\n\nAs a platform provided for an ecosystem, you would create custom test tasks and use the `TestEventReporter` APIs to generate test events.\n\nAs a tooling integrator, like an IDE, you would use the Tooling API client to receive test events and display them as appropriate to the user.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbig-guy%2Fsample-custom-test-task","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbig-guy%2Fsample-custom-test-task","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbig-guy%2Fsample-custom-test-task/lists"}