{"id":17031456,"url":"https://github.com/platan/tests-execution-chart","last_synced_at":"2025-04-12T12:32:21.985Z","repository":{"id":62130369,"uuid":"549810072","full_name":"platan/tests-execution-chart","owner":"platan","description":"Gradle plugin that visualises tests execution schedule","archived":false,"fork":false,"pushed_at":"2025-03-30T18:22:14.000Z","size":3789,"stargazers_count":14,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-06T09:47:45.907Z","etag":null,"topics":["chart","execution","gantt","gradle","parallel","report","schedule","tests"],"latest_commit_sha":null,"homepage":"https://plugins.gradle.org/plugin/io.github.platan.tests-execution-chart","language":"Groovy","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/platan.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":"2022-10-11T19:19:32.000Z","updated_at":"2025-03-30T18:22:16.000Z","dependencies_parsed_at":"2023-10-16T08:20:07.890Z","dependency_job_id":"fb309e74-ab47-4a48-99f2-4e3f32a5bdac","html_url":"https://github.com/platan/tests-execution-chart","commit_stats":{"total_commits":439,"total_committers":10,"mean_commits":43.9,"dds":"0.45558086560364464","last_synced_commit":"cb956aead325dd2ffb12dcab3f33dcd32e3a2e03"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/platan%2Ftests-execution-chart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/platan%2Ftests-execution-chart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/platan%2Ftests-execution-chart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/platan%2Ftests-execution-chart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/platan","download_url":"https://codeload.github.com/platan/tests-execution-chart/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248566599,"owners_count":21125694,"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":["chart","execution","gantt","gradle","parallel","report","schedule","tests"],"created_at":"2024-10-14T08:24:17.125Z","updated_at":"2025-04-12T12:32:19.373Z","avatar_url":"https://github.com/platan.png","language":"Groovy","readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"src/etc/logo/logo.svg\" height=\"140\"\u003e\n\u003c/p\u003e\n\n**Gradle plugin that visualises tests execution schedule**\n\n[![build status](https://img.shields.io/github/actions/workflow/status/platan/tests-execution-chart/ci.yml?branch=main)](https://github.com/platan/tests-execution-chart/actions/workflows/ci.yml)\n[![Codecov](https://img.shields.io/codecov/c/github/platan/tests-execution-chart)](https://app.codecov.io/gh/platan/tests-execution-chart)\n[![Gradle Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/io.github.platan.tests-execution-chart)](https://plugins.gradle.org/plugin/io.github.platan.tests-execution-chart)\n[![This project is using Percy.io for visual regression testing.](https://img.shields.io/badge/visual%20testing-percy-9E66BF?logo=percy\u0026logoColor=white)](https://percy.io/e8832041/tests-execution-chart)\n\n# Usage\n\n`build.gradle.kts`:\n\n```kotlin\nplugins {\n    id(\"io.github.platan.tests-execution-chart\") version \"0.6.1\"\n}\n```\n\n`build.gradle`:\n\n```gradle\nplugins {\n    id \"io.github.platan.tests-execution-chart\" version \"0.6.1\"\n}\n```\n\n```sh\n./gradlew test createTestsExecutionReport --rerun-tasks\n\n#...\n\nTests execution schedule report saved to /my-project/build/reports/tests-execution/mermaid/test.txt file.\nTests execution schedule report saved to /my-project/build/reports/tests-execution/json/test.json file.\nTests execution schedule report saved to /my-project/build/reports/tests-execution/html/test.html file.\n```\n\nExample result (HTML report):\n\n\u003cp align=\"center\"\u003e\n    \u003cpicture\u003e\n      \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\".readme/example_dark.svg\"\u003e\n      \u003cimg src=\".readme/example.svg\"\u003e\n    \u003c/picture\u003e\n\u003c/p\u003e\n\n# Reports\n\n`createTestsExecutionReport` task creates reports in HTML, JSON and [Mermaid](https://mermaid-js.github.io/mermaid/#/) formats.\n\n## HTML\n\nLocated in `build/reports/tests-execution/html/*.html`.\n\n\u003cpicture\u003e\n      \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\".readme/example-html-report-dark.png\"\u003e\n      \u003cimg src=\".readme/example-html-report.png\"\u003e\n\u003c/picture\u003e\n\n## JSON\n\nLocated in `build/reports/tests-execution/json/*.json`.\n\n- `startTime` - in milliseconds since the epoch\n- `endTime` - in milliseconds since the epoch\n\n```json\n{\n  \"results\": [\n    {\n      \"className\": \"Test1Spec\",\n      \"durationMs\": 120,\n      \"endTime\": 1667936777974,\n      \"startTime\": 1667936777854,\n      \"resultType\": \"SUCCESS\",\n      \"testName\": \"test 2\"\n    },\n    {\n      \"className\": \"Test1Spec\",\n      \"durationMs\": 213,\n      \"endTime\": 1667936778067,\n      \"startTime\": 1667936777854,\n      \"resultType\": \"SUCCESS\",\n      \"testName\": \"test 1\"\n    }\n  ]\n}\n```\n\n## Mermaid\n\nLocated in `build/reports/tests-execution/mermaid/*.txt`.\n\n```\ngantt\ndateFormat YYYY-MM-DDTHH:mm:ss.SSSZZ\naxisFormat %H:%M:%S.%L\nsection Test1Spec\ntest 2 - 120 ms :active, 2022-11-08T20:46:17.854+0100, 2022-11-08T20:46:17.974+0100\ntest 1 - 213 ms :active, 2022-11-08T20:46:17.854+0100, 2022-11-08T20:46:18.067+0100\n```\n\nrendered: ([info](https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/)):\n\n```mermaid\ngantt\n    dateFormat YYYY-MM-DDTHH:mm:ss.SSSZZ\n    axisFormat %H:%M:%S.%L\n    section Test1Spec\n        test 2 - 120 ms: active, 2022-11-08T20:46:17.854+0100, 2022-11-08T20:46:17.974+0100\n        test 1 - 213 ms: active, 2022-11-08T20:46:17.854+0100, 2022-11-08T20:46:18.067+0100\n```\n\n# Configuration\n\nOptions:\n\n| Key                                      | Type    | Description                                                        | Default                                                          |\n|------------------------------------------|---------|--------------------------------------------------------------------|------------------------------------------------------------------|\n| `formats.html.enabled`                   | boolean | Generate report in html format                                     | `true`                                                           |\n| `formats.html.script.embed`              | boolean | If true mermaid source will be downloaded and used locally in html | `false`                                                          |\n| `formats.html.script.src`                | url     | Url to mermaid which should be used to generate html report        | `https://cdn.jsdelivr.net/npm/mermaid@11.3.0/dist/mermaid.min.js`|\n| `formats.html.script.config.maxTextSize` | int     | Limit on the size of text used to generate diagrams                | `50000`                                                          |\n| `formats.json.enabled`                   | boolean | Generate report in json format                                     | `true`                                                           |\n| `formats.mermaid.enabled`                | boolean | Generate report in mermaid text format                             | `true`                                                           |\n| `components.suites.enabled`              | boolean | Add suites/classes to report                                       | `false`                                                          |\n| `shiftTimestampsToStartOfDay`            | boolean | Adjust the earliest timestamp to the start of the day              | `false`                                                          |\n| `marks.totalTimeOfAllTests.enabled`      | boolean | Enable mark showing total time of all tests                        | `false`                                                          |\n| `marks.totalTimeOfAllTests.name`         | string  | Label used for mark                                                | `total time of all tests`                                        |\n\n`build.gradle.kts`:\n\n```kotlin\nconfigure\u003cio.github.platan.tests_execution_chart.CreateTestsExecutionReportExtension\u003e {\n    formats {\n        html {\n            enabled.set(true)\n            script {\n                embed.set(false)\n                config {\n                    maxTextSize.set(110000)\n                }\n                src.set(\"https://cdn.jsdelivr.net/npm/mermaid@11.3.0/dist/mermaid.min.js\")\n            }\n        }\n        json {\n            enabled.set(true)\n        }\n        mermaid {\n            enabled.set(true)\n        }\n    }\n    components {\n        suites {\n            enabled.set(false)\n        }\n    }\n    shiftTimestampsToStartOfDay.set(true)\n    marks {\n        totalTimeOfAllTests {\n            enabled.set(true)\n            name.set(\"total time of all tests\")\n        }\n    }\n}\n```\n\n`build.gradle`:\n\n```gradle\ncreateTestsExecutionReport {\n    formats {\n        html {\n            enabled = true\n            script {\n                embed = false\n                config {\n                    maxTextSize = 110000\n                }\n                src = \"https://cdn.jsdelivr.net/npm/mermaid@11.3.0/dist/mermaid.min.js\"\n            }\n        }\n        json {\n            enabled = true\n        }\n        mermaid {\n            enabled = true\n        }\n    }\n    components {\n        suites {\n            enabled = false\n        }\n    }\n    shiftTimestampsToStartOfDay = true\n    marks {\n        totalTimeOfAllTests {\n            enabled = true\n            name = 'total time of all tests'\n        }\n    }\n}\n```\n\n## Option `components.suites.enabled`\n\nWhen enabled (set to `true`) it allows to add suites/classed to report. \n\n\u003cpicture\u003e\n      \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\".readme/example-html-report-suites-dark.png\"\u003e\n      \u003cimg src=\".readme/example-html-report-suites.png\"\u003e\n\u003c/picture\u003e\n\n# Troubleshooting\n\n\u003e I see `Maximum text size in diagram exceeded` in an HTML report instead of a chart.\n\nMermaid has limit of maximum allowed size of the text diagram. Default value of this size is 50000. This can be overridden using `formats.html.script.config.maxTextSize` option.\n\n# Development\n\nYou can publish plugin locally:\n\n```sh\ncd tests-execution-chart\n./gradlew publish\n```\n\nArtifacts are published to `../local-plugin-repository` directory.\n\nConfigure your project:\n\n`settings.gradle` (set proper path instead of `/path-to`):\n\n```gradle\npluginManagement {\n    repositories {\n        maven {\n            url '/path-to/local-plugin-repository'\n        }\n        gradlePluginPortal()\n    }\n}\n\n```\n\n`build.gradle` (replace `X.X.X-SNAPSHOT` with the value returned by `./gradlew cV -q -Prelease.quiet`):\n\n```gradle\nplugins {\n    id 'io.github.platan.tests-execution-chart' version 'X.X.X-SNAPSHOT'\n}\n```\n\n# Release\n\n1. `./gradlew createRelease -Prelease.versionIncrementer=incrementPatch/incrementMinor/incrementMinor` - creates a new tag and updates examples in README (but does not commit changes in README)\n2. `git push origin release-[X.X.X]`\n3. Prepare `~/.gradle/gradle.properties` (`gradle.publish.key`, `gradle.publish.secret`) and run `./gradlew clean :tests-execution-chart-commons:publishToSonatype closeSonatypeStagingRepository`\n4. Verify `tests-execution-chart-commons` module in staging repository (https://s01.oss.sonatype.org)\n5. Run `./gradlew findSonatypeStagingRepository releaseSonatypeStagingRepository`\n6. Prepare `~/.gradle/gradle.properties` (`sonatypeUsername`, `sonatypePassword`, `signing.keyId`, `signing.password`, `signing.secretKeyRingFile`) and run `./gradlew clean build publishPlugins`\n7. Edit Changelog in README.md and `git commit -m \"Document release [X.X.X]\"`\n8. Update `io.github.platan.tests-execution-chart` plugin version in this project\n\n# Modules\n\n## tests-execution-chart-commons\n\n[tests-execution-chart-commons](tests-execution-chart-commons) module contains common code which is used by the plugin. This library can be also used to build other tools.\n\n# Motivation\n\n[JUnit](https://junit.org/junit5/docs/5.9.0/user-guide/#writing-tests-parallel-execution) and [Spock](https://spockframework.org/spock/docs/2.3/parallel_execution.html) support parallel execution. Both frameworks allow configuring execution mode for classes/specifications and methods/features. JUnit/Spock documentation illustrates how this configuration affects the execution schedule of tests.\n\nUnfortunately, I did not find existing tool which allows to visualise tests executions schedule for particular project. This Gradle plugin tries to address this need.\n\nGradle can generate reports in JUnit XML format. But such reports cannot be used to generate charts, because they do not have start timestamps for test methods, only for test classes (with seconds precision).\n\n# Changelog\n\n## Unreleased\n\n## 0.6.1 (16 October 2024)\n\n### Changed\n\n- Mermaid library updated to version 11.3.0\n\n## 0.6.0 (17 October 2023)\n\n### Added\n\n- Add option to include suites/classes in report\n\n## 0.5.0 (15 October 2023)\n\n### Changed\n\n- Mermaid library updated to version 10.5.0\n\n## 0.4.0 (1 June 2023)\n\n### Added\n\n- A new option `marks.totalTimeOfAllTests` allows to add mark showing total time of all tests\n\n### Changed\n\n- Do not remove `#` character from names of tasks/sections\n\n## 0.3.1 (29 March 2023)\n\n### Added\n\n- A new option `shiftTimestampsToStartOfDay` allows to adjust the earliest timestamp to the start of the day\n\n## 0.3.0 (12 March 2023)\n\n### Changed\n\n- Use `dateFormat` compatible with Mermaid 9.4.2\n- Link to Mermaid 9.4.3 instead of the latest version\n\n## 0.2.1 (07 March 2023)\n\n- (fix) Render chart in HTML report when the test name contains a backtick character\n\n## 0.2.0 (02 February 2023)\n\n- (feature) Allow to set `maxTextSize` config option in Mermaid script in HTML report\n\n## 0.1.0 (09 November 2022)\n\n- Add option to create a report that visualises the tests execution schedule\n\n# License\n\nThis project is licensed under the [MIT license](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplatan%2Ftests-execution-chart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplatan%2Ftests-execution-chart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplatan%2Ftests-execution-chart/lists"}