├── .editorconfig ├── .github ├── dependabot.yml └── workflows │ ├── ci.yml │ ├── publish-snapshot.yml │ └── wrapper-upgrade-execution.yml ├── .gitignore ├── .java-version ├── .readme ├── example-html-report-dark.png ├── example-html-report-suites-dark.png ├── example-html-report-suites.png ├── example-html-report.png ├── example.svg ├── example_dark.svg └── prepare_example_charts.sh ├── LICENSE ├── README.md ├── build.gradle.kts ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── puppeteer-config.json ├── settings.gradle ├── src ├── etc │ └── logo │ │ └── logo.svg ├── functionalTest │ ├── groovy │ │ └── io │ │ │ └── github │ │ │ └── platan │ │ │ └── tests_execution_chart │ │ │ ├── ReportsFunctionalTest.groovy │ │ │ └── reporters │ │ │ └── mermaid │ │ │ └── MermaidGanttDiagramFormatterToSvgConversionSpec.groovy │ ├── kotlin │ │ └── io │ │ │ └── github │ │ │ └── platan │ │ │ └── tests_execution_chart │ │ │ └── JsonToHtmlReportApp.kt │ └── resources │ │ ├── MySpec.groovy │ │ ├── build.gradle │ │ └── report-visual-regression.json ├── main │ └── kotlin │ │ └── io │ │ └── github │ │ └── platan │ │ └── tests_execution_chart │ │ ├── CreateTestsExecutionReportExtension.kt │ │ └── gradle │ │ ├── CreateTestsExecutionReportTask.kt │ │ ├── TestExecutionResultsRegisterService.kt │ │ ├── TestExecutionScheduleTestListener.kt │ │ ├── TestsExecutionReportPlugin.kt │ │ └── config │ │ ├── Components.kt │ │ ├── Mark.kt │ │ ├── Marks.kt │ │ ├── TotalTimeOfAllTestsMark.kt │ │ └── formats │ │ ├── Format.kt │ │ ├── Formats.kt │ │ ├── Html.kt │ │ ├── Script.kt │ │ ├── ScriptConfig.kt │ │ ├── Suites.kt │ │ ├── json │ │ └── Json.kt │ │ └── mermaid │ │ └── Mermaid.kt └── visual-regression │ ├── .gitignore │ ├── package-lock.json │ ├── package.json │ ├── playwright.config.ts │ └── tests │ └── report.spec.ts ├── test-projects.ps1 ├── test-projects.sh ├── test-projects ├── checks.gradle ├── junit5-single-module │ ├── .gitignore │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ └── test │ │ ├── java │ │ ├── Test1Test.java │ │ ├── Test2Test.java │ │ └── TestIsolatedSpec.java │ │ └── resources │ │ └── junit-platform.properties ├── kotest-single-module │ ├── .gitignore │ ├── build.gradle.kts │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle.kts │ └── src │ │ └── test │ │ └── kotlin │ │ ├── KotestProjectConfig.kt │ │ ├── Test1.kt │ │ ├── Test2.kt │ │ └── TestIsolated.kt ├── spock-multi-module │ ├── .gitignore │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── module1 │ │ ├── build.gradle │ │ └── src │ │ │ └── test │ │ │ ├── groovy │ │ │ ├── Test1Spec.groovy │ │ │ ├── Test2Spec.groovy │ │ │ └── TestIsolatedSpec.groovy │ │ │ └── resources │ │ │ └── SpockConfig.groovy │ ├── module2 │ │ ├── build.gradle │ │ └── src │ │ │ └── test │ │ │ ├── groovy │ │ │ ├── Test1Spec.groovy │ │ │ ├── Test2Spec.groovy │ │ │ └── TestIsolatedSpec.groovy │ │ │ └── resources │ │ │ └── SpockConfig.groovy │ ├── settings.gradle │ └── src │ │ └── test │ │ ├── groovy │ │ ├── MySpec.groovy │ │ ├── Test1Spec.groovy │ │ ├── Test2Spec.groovy │ │ └── TestIsolatedSpec.groovy │ │ └── resources │ │ └── SpockConfig.groovy ├── spock-multiple-test-tasks │ ├── .gitignore │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ └── intTest │ │ ├── groovy │ │ ├── Test1Spec.groovy │ │ ├── Test2Spec.groovy │ │ └── TestIsolatedSpec.groovy │ │ └── resources │ │ └── SpockConfig.groovy ├── spock-single-module │ ├── .gitignore │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ └── test │ │ ├── groovy │ │ ├── Test1Spec.groovy │ │ ├── Test2Spec.groovy │ │ └── TestIsolatedSpec.groovy │ │ └── resources │ │ └── SpockConfig.groovy └── testNG-single-module │ ├── .gitignore │ ├── build.gradle │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ └── test │ ├── java │ ├── Test1.java │ ├── Test2.java │ └── TestIsolated.java │ └── resources │ ├── testng-isolated.xml │ └── testng-parallel.xml └── tests-execution-chart-commons ├── build.gradle.kts └── src ├── main ├── kotlin │ └── io │ │ └── github │ │ └── platan │ │ └── tests_execution_chart │ │ ├── report │ │ ├── ReportConfig.kt │ │ ├── ReportConfigurator.kt │ │ ├── ReportCreator.kt │ │ ├── TestExecutionScheduleReportBuilder.kt │ │ └── data │ │ │ ├── Mark.kt │ │ │ ├── TestExecutionScheduleReport.kt │ │ │ └── TimedTestResult.kt │ │ └── reporters │ │ ├── GanttDiagramReporter.kt │ │ ├── Logger.kt │ │ ├── NoopLogger.kt │ │ ├── SingleFileReportWriter.kt │ │ ├── TestExecutionReportFormatter.kt │ │ ├── html │ │ ├── HtmlConfig.kt │ │ ├── HtmlGanttDiagramFormatter.kt │ │ ├── HtmlGanttDiagramReporter.kt │ │ └── HtmlTableFormatter.kt │ │ ├── json │ │ ├── JsonConfig.kt │ │ ├── JsonReporter.kt │ │ └── JsonTestExecutionReportFormatter.kt │ │ └── mermaid │ │ ├── MermaidConfig.kt │ │ ├── MermaidTestsReporter.kt │ │ ├── TestExecutionMermaidDiagramFormatter.kt │ │ └── core │ │ ├── MermaidGanttDiagram.kt │ │ └── MermaidGanttDiagramFormatter.kt └── resources │ ├── META-INF │ └── services │ │ └── io.github.platan.tests_execution_chart.reporters.GanttDiagramReporter │ └── template.html └── test └── groovy └── io └── github └── platan └── tests_execution_chart ├── report ├── ReportCreatorTest.groovy ├── TestExecutionScheduleReportMarksTest.groovy ├── TestExecutionScheduleReportTest.groovy └── TimedTestResultTest.groovy └── reporters ├── html └── HtmlGanttDiagramReporterTest.groovy ├── json ├── JsonReporterTest.groovy └── JsonTestExecutionReportFormatterTest.groovy └── mermaid ├── MermaidTestsReporterTest.groovy ├── TestExecutionMermaidDiagramFormatterSpec.groovy └── core ├── MermaidGanttDiagramBuilderTest.groovy └── MermaidGanttDiagramFormatterTest.groovy /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.kt] 2 | ktlint_standard_package-name = disabled 3 | ktlint_standard_trailing-comma-on-call-site = disabled 4 | ktlint_standard_trailing-comma-on-declaration-site = disabled 5 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gradle" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | ignore: 8 | - dependency-name: "org.spockframework:spock-bom" 9 | versions: ["2.x-groovy-4.x", "2.x-x-groovy-4.x"] 10 | - dependency-name: "*" 11 | update-types: ["version-update:semver-patch"] 12 | - package-ecosystem: "github-actions" 13 | directory: "/" 14 | schedule: 15 | interval: "weekly" 16 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | paths-ignore: 6 | - 'README.md' 7 | branches-ignore: 8 | - 'dependabot/**' 9 | pull_request: 10 | workflow_dispatch: 11 | 12 | permissions: 13 | contents: read 14 | 15 | jobs: 16 | build-on-linux: 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: actions/checkout@v4 20 | - name: Set up JDK 11 21 | uses: actions/setup-java@v4 22 | with: 23 | java-version: '11' 24 | distribution: 'temurin' 25 | # https://github.com/mermaid-js/mermaid-cli/blob/master/docs/linux-sandbox-issue.md 26 | - name: Create Puppeteer config 27 | run: 'echo "{\"args\": [\"--no-sandbox\"]}" > puppeteer-config.json' 28 | - name: Build with Gradle 29 | uses: gradle/gradle-build-action@v3 30 | with: 31 | arguments: build 32 | - name: Upload coverage reports to Codecov 33 | uses: codecov/codecov-action@v5 34 | env: 35 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 36 | - name: Create tests execution report for all test projects 37 | run: ./test-projects.sh test createTestsExecutionReport 38 | - name: Check reports were created 39 | run: ./test-projects.sh checkReports 40 | - name: Create HTML report for regression tests 41 | uses: gradle/gradle-build-action@v3 42 | with: 43 | arguments: createRegressionHtmlReport 44 | - uses: actions/setup-node@v4 45 | with: 46 | node-version: 20 47 | - name: Install dependencies 48 | run: npm ci 49 | working-directory: src/visual-regression 50 | - name: Install Playwright Browsers 51 | run: npx playwright install --with-deps 52 | working-directory: src/visual-regression 53 | - name: Run Playwright tests with Percy 54 | run: npx percy exec -- npx playwright test 55 | env: 56 | PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} 57 | working-directory: src/visual-regression 58 | 59 | build-on-windows: 60 | runs-on: windows-latest 61 | steps: 62 | - uses: actions/checkout@v4 63 | - name: Set up JDK 11 64 | uses: actions/setup-java@v4 65 | with: 66 | java-version: '11' 67 | distribution: 'temurin' 68 | - name: Build with Gradle 69 | uses: gradle/gradle-build-action@v3 70 | with: 71 | arguments: build -i 72 | - name: Create tests execution report for all test projects 73 | run: ./test-projects.ps1 test createTestsExecutionReport 74 | - name: Check reports were created 75 | run: ./test-projects.ps1 checkReports 76 | - name: Create HTML report for regression tests 77 | uses: gradle/gradle-build-action@v3 78 | with: 79 | arguments: createRegressionHtmlReport 80 | -------------------------------------------------------------------------------- /.github/workflows/publish-snapshot.yml: -------------------------------------------------------------------------------- 1 | name: Publish package to GitHub Packages 2 | on: 3 | push: 4 | paths-ignore: 5 | - 'README.md' 6 | branches-ignore: 7 | - 'dependabot/**' 8 | jobs: 9 | publish: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | contents: read 13 | packages: write 14 | steps: 15 | - uses: actions/checkout@v4 16 | with: 17 | fetch-tags: true 18 | fetch-depth: 0 19 | - uses: actions/setup-java@v4 20 | with: 21 | java-version: '11' 22 | distribution: 'temurin' 23 | - name: Validate Gradle wrapper 24 | uses: gradle/wrapper-validation-action@v3 25 | - name: Get current version 26 | id: current-version 27 | # $VERSION should contain something like "Project version: 0.4.1-SNAPSHOT" 28 | run: | 29 | VERSION=$(./gradlew currentVersion -q | grep "Project version") 30 | echo "currentVersionInfo=$VERSION" >> "$GITHUB_OUTPUT" 31 | - name: Publish package to Sonatype 32 | if: ${{ contains(steps.current-version.outputs.currentVersionInfo, 'SNAPSHOT') }} 33 | uses: gradle/gradle-build-action@v3 34 | with: 35 | arguments: :tests-execution-chart-commons:publishToSonatype -i 36 | env: 37 | ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} 38 | ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} 39 | -------------------------------------------------------------------------------- /.github/workflows/wrapper-upgrade-execution.yml: -------------------------------------------------------------------------------- 1 | name: Execute Wrapper Upgrade 2 | 3 | on: 4 | schedule: 5 | - cron: '0 2 * * *' 6 | workflow_dispatch: 7 | 8 | jobs: 9 | upgrade_wrapper: 10 | name: Execution 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Set up Git configuration 14 | env: 15 | TOKEN: ${{ secrets.GITHUB_TOKEN }} 16 | run: | 17 | git config --global url."https://unused-username:${TOKEN}@github.com/".insteadOf "https://github.com/" 18 | git config --global user.name 'github-actions[bot]' 19 | git config --global user.email 'github-actions[bot]@users.noreply.github.com' 20 | - name: Checkout 21 | uses: actions/checkout@v4 22 | - name: Set up JDK 23 | uses: actions/setup-java@v4 24 | with: 25 | java-version: '17' 26 | distribution: 'temurin' 27 | - name: Set up Gradle 28 | uses: gradle/actions/setup-gradle@v4 29 | - name: Upgrade Wrappers 30 | run: ./gradlew clean upgradeGradleWrapperAll --continue -Porg.gradle.java.installations.auto-download=false 31 | env: 32 | WRAPPER_UPGRADE_GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | **/build/ 3 | !src/**/build/ 4 | 5 | # Ignore Gradle GUI config 6 | gradle-app.setting 7 | 8 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 9 | !gradle-wrapper.jar 10 | 11 | # Avoid ignore Gradle wrappper properties 12 | !gradle-wrapper.properties 13 | 14 | # Cache of project 15 | .gradletasknamecache 16 | 17 | # Eclipse Gradle plugin generated files 18 | # Eclipse Core 19 | .project 20 | # JDT-specific (Eclipse Java Development Tools) 21 | .classpath 22 | 23 | .idea 24 | -------------------------------------------------------------------------------- /.java-version: -------------------------------------------------------------------------------- 1 | 11.0 2 | -------------------------------------------------------------------------------- /.readme/example-html-report-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/platan/tests-execution-chart/a76059793ac9f0f7721f4c3d7543efd16449135a/.readme/example-html-report-dark.png -------------------------------------------------------------------------------- /.readme/example-html-report-suites-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/platan/tests-execution-chart/a76059793ac9f0f7721f4c3d7543efd16449135a/.readme/example-html-report-suites-dark.png -------------------------------------------------------------------------------- /.readme/example-html-report-suites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/platan/tests-execution-chart/a76059793ac9f0f7721f4c3d7543efd16449135a/.readme/example-html-report-suites.png -------------------------------------------------------------------------------- /.readme/example-html-report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/platan/tests-execution-chart/a76059793ac9f0f7721f4c3d7543efd16449135a/.readme/example-html-report.png -------------------------------------------------------------------------------- /.readme/prepare_example_charts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | npx -p @mermaid-js/mermaid-cli mmdc -i ../test-projects/spock-single-module/build/reports/tests-execution/mermaid/test.txt -o example_dark.svg -t dark -b transparent 4 | npx -p @mermaid-js/mermaid-cli mmdc -i ../test-projects/spock-single-module/build/reports/tests-execution/mermaid/test.txt -o example.svg -b transparent 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Marcin Mielnicki 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | import pl.allegro.tech.build.axion.release.domain.hooks.HookContext 2 | 3 | plugins { 4 | id("org.jetbrains.kotlin.jvm") version "2.1.0" 5 | `java-gradle-plugin` 6 | `maven-publish` 7 | groovy 8 | id("com.gradle.plugin-publish") version "1.3.0" 9 | id("com.diffplug.spotless") version "7.0.2" 10 | id("com.github.jakemarsden.git-hooks") version "0.0.2" 11 | id("io.github.platan.tests-execution-chart") version "0.6.1" 12 | kotlin("plugin.serialization") version "2.1.0" 13 | id("pl.allegro.tech.build.axion-release") version "1.18.2" 14 | id("com.github.ben-manes.versions") version "0.52.0" 15 | id("io.github.gradle-nexus.publish-plugin") version "2.0.0-rc-1" 16 | id("org.gradle.wrapper-upgrade") version "0.12" 17 | } 18 | 19 | scmVersion { 20 | tag { 21 | prefix.set("release-") 22 | } 23 | hooks { 24 | pre( 25 | "fileUpdate", 26 | mapOf( 27 | "file" to "README.md", 28 | "pattern" to KotlinClosure2({ previousVersion, _ -> "version \"$previousVersion\"" }), 29 | "replacement" to KotlinClosure2({ releaseVersion, _ -> "version \"$releaseVersion\"" }), 30 | ), 31 | ) 32 | } 33 | } 34 | 35 | allprojects { 36 | apply(plugin = "groovy") 37 | 38 | repositories { 39 | mavenCentral() 40 | } 41 | 42 | tasks.test { 43 | useJUnitPlatform() 44 | testLogging { 45 | events("passed", "skipped", "failed") 46 | } 47 | } 48 | 49 | group = "io.github.platan" 50 | project.version = rootProject.scmVersion.version 51 | } 52 | 53 | val functionalTest = sourceSets.create("functionalTest") { 54 | compileClasspath += sourceSets.main.get().output 55 | runtimeClasspath += sourceSets.main.get().output 56 | } 57 | 58 | val functionalTestImplementation by configurations.getting { 59 | extendsFrom(configurations.implementation.get()) 60 | } 61 | 62 | configurations["functionalTestRuntimeOnly"].extendsFrom(configurations.runtimeOnly.get()) 63 | 64 | dependencies { 65 | implementation(project(":tests-execution-chart-commons")) 66 | implementation("org.jetbrains.kotlin:kotlin-stdlib") 67 | implementation(gradleApi()) 68 | implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0") 69 | 70 | testImplementation(platform("org.codehaus.groovy:groovy-bom:3.0.22")) 71 | testImplementation("org.codehaus.groovy:groovy") 72 | testImplementation(platform("org.spockframework:spock-bom:2.4-M2-groovy-3.0")) 73 | testImplementation("org.spockframework:spock-core") 74 | } 75 | 76 | gradlePlugin { 77 | website = "https://github.com/platan/tests-execution-chart" 78 | vcsUrl = "https://github.com/platan/tests-execution-chart.git" 79 | plugins { 80 | create("testsExecutionReportPlugin") { 81 | id = "io.github.platan.tests-execution-chart" 82 | displayName = "Visualise tests execution schedule" 83 | description = "Visualise tests execution schedule" 84 | implementationClass = "io.github.platan.tests_execution_chart.gradle.TestsExecutionReportPlugin" 85 | tags = listOf("test", "tests", "execution", "schedule", "report", "gantt", "chart", "parallel") 86 | } 87 | } 88 | } 89 | 90 | val functionalTestTask = tasks.register("functionalTest") { 91 | group = "verification" 92 | testClassesDirs = functionalTest.output.classesDirs 93 | classpath = functionalTest.runtimeClasspath 94 | useJUnitPlatform() 95 | } 96 | 97 | tasks.check { 98 | dependsOn(functionalTestTask) 99 | } 100 | 101 | gradlePlugin { 102 | testSourceSets(functionalTest) 103 | } 104 | 105 | dependencies { 106 | "functionalTestImplementation"("org.spockframework:spock-core:2.3-groovy-3.0") { 107 | exclude(group = "org.codehaus.groovy") 108 | } 109 | functionalTestImplementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0") 110 | functionalTestImplementation("com.github.ajalt.clikt:clikt:5.0.0") 111 | } 112 | 113 | publishing { 114 | publications { 115 | create("plugin") { 116 | groupId = groupId 117 | artifactId = artifactId 118 | version = version 119 | from(components["java"]) 120 | } 121 | } 122 | repositories { 123 | maven { 124 | name = "localPluginRepository" 125 | url = uri("../local-plugin-repository") 126 | } 127 | } 128 | } 129 | 130 | nexusPublishing { 131 | repositories { 132 | create("sonatype") { 133 | nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) 134 | snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) 135 | } 136 | } 137 | } 138 | 139 | configure { 140 | kotlin { 141 | ktlint("0.50.0") 142 | } 143 | kotlinGradle { 144 | target("*.gradle.kts") 145 | ktlint().editorConfigOverride( 146 | mapOf("indent_size" to "4"), 147 | ) 148 | } 149 | } 150 | 151 | gitHooks { 152 | setHooks(mapOf("pre-commit" to "spotlessCheck")) 153 | } 154 | 155 | tasks.register("createRegressionHtmlReport") { 156 | classpath = sourceSets["functionalTest"].runtimeClasspath 157 | mainClass.set("io.github.platan.tests_execution_chart.JsonToHtmlReportApp") 158 | setArgsString("--input ./src/functionalTest/resources/report-visual-regression.json --output-dir build") 159 | } 160 | 161 | wrapperUpgrade { 162 | gradle { 163 | register("tests-execution-chart") { 164 | repo.set("platan/tests-execution-chart") 165 | baseBranch.set("main") 166 | } 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/platan/tests-execution-chart/a76059793ac9f0f7721f4c3d7543efd16449135a/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionSha256Sum=61ad310d3c7d3e5da131b76bbf22b5a4c0786e9d892dae8c1658d4b484de3caa 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH= 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /puppeteer-config.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'tests-execution-chart' 2 | include 'tests-execution-chart-commons' 3 | 4 | -------------------------------------------------------------------------------- /src/etc/logo/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/functionalTest/groovy/io/github/platan/tests_execution_chart/reporters/mermaid/MermaidGanttDiagramFormatterToSvgConversionSpec.groovy: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.mermaid 2 | 3 | import io.github.platan.tests_execution_chart.reporters.mermaid.core.MermaidGanttDiagram 4 | import io.github.platan.tests_execution_chart.reporters.mermaid.core.MermaidGanttDiagramFormatter 5 | import spock.lang.Retry 6 | import spock.lang.Specification 7 | import spock.lang.TempDir 8 | 9 | class MermaidGanttDiagramFormatterToSvgConversionSpec extends Specification { 10 | 11 | @TempDir 12 | File tempDir 13 | def inputFile 14 | def inputPath 15 | def outputPath 16 | def processOutput = new StringBuilder() 17 | def processError = new StringBuilder() 18 | 19 | def final static SPECIAL_CHARS = '''!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~''' 20 | 21 | def setup() { 22 | inputFile = new File(tempDir, "input.mmd") 23 | inputPath = inputFile.getAbsolutePath() 24 | outputPath = new File(tempDir, "output.svg").getAbsolutePath() 25 | } 26 | 27 | // Fails sometimes on Windows runner 28 | @Retry(mode = Retry.Mode.SETUP_FEATURE_CLEANUP, count = 5) 29 | def "should produce result parsable by mmdc (mermaid CLI)"() { 30 | given: 31 | def diagramBuilder = new MermaidGanttDiagram.MermaidGanttDiagramBuilder() 32 | diagramBuilder.addSection("test-section $SPECIAL_CHARS") 33 | diagramBuilder.addTask("test-row $SPECIAL_CHARS", 'active', 1, 2) 34 | diagramBuilder.addMilestone("test-milestone $SPECIAL_CHARS", 1) 35 | def diagram = diagramBuilder.build("YYYY-MM-DD\\THH\\:mm\\:ss\\.SSSZ", "%H:%M:%S.%L") 36 | def mermaid = new MermaidGanttDiagramFormatter().format(diagram, "yyyy-MM-dd'T'HH:mm:ss.SSSZ") 37 | inputFile.text = mermaid 38 | 39 | when: 40 | def process = "${getCommand("npx")} -p @mermaid-js/mermaid-cli mmdc -p puppeteer-config.json -i $inputPath -o $outputPath".execute() 41 | 42 | then: 43 | process.consumeProcessOutput(processOutput, processError) 44 | process.waitForOrKill(300000) 45 | assert process.exitValue() == 0, "Process finished with exit code ${process.exitValue()}\nOutput: $processOutput\nError: $processError" 46 | } 47 | 48 | String getCommand(String command) { 49 | if (System.properties['os.name'].toString().toLowerCase().contains('windows')) { 50 | return "${command}.cmd" 51 | } else { 52 | return command 53 | } 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /src/functionalTest/kotlin/io/github/platan/tests_execution_chart/JsonToHtmlReportApp.kt: -------------------------------------------------------------------------------- 1 | @file:JvmName("JsonToHtmlReportApp") 2 | 3 | package io.github.platan.tests_execution_chart 4 | 5 | import com.github.ajalt.clikt.core.CliktCommand 6 | import com.github.ajalt.clikt.core.main 7 | import com.github.ajalt.clikt.parameters.options.default 8 | import com.github.ajalt.clikt.parameters.options.option 9 | import com.github.ajalt.clikt.parameters.options.required 10 | import com.github.ajalt.clikt.parameters.types.boolean 11 | import com.github.ajalt.clikt.parameters.types.int 12 | import io.github.platan.tests_execution_chart.report.ReportConfig 13 | import io.github.platan.tests_execution_chart.report.ReportCreator 14 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 15 | import io.github.platan.tests_execution_chart.reporters.Logger 16 | import io.github.platan.tests_execution_chart.reporters.html.HtmlConfig 17 | import kotlinx.serialization.ExperimentalSerializationApi 18 | import kotlinx.serialization.json.Json 19 | import kotlinx.serialization.json.decodeFromStream 20 | import java.io.File 21 | import java.io.FileInputStream 22 | 23 | private val json = Json { ignoreUnknownKeys = true } 24 | 25 | private val logger = object : Logger { 26 | override fun lifecycle(message: String) { 27 | println(message) 28 | } 29 | } 30 | 31 | private class CommandLineParser : CliktCommand() { 32 | val input by option(envvar = "input", help = "Input file in JSON format").required() 33 | val outputDir by option(envvar = "output-dir").required() 34 | val mermaidScriptSrc by option(envvar = "mermaid-script-src").default(HtmlConfig.Script.getSrcDefault()) 35 | val embed by option(envvar = "embed-mermaid-script").boolean().default(false) 36 | val maxTextSize by option(envvar = "mermaid-max-text-size").int().default(50_000) 37 | val taskName by option(envvar = "task-name").default("test") 38 | 39 | override fun run() = Unit 40 | } 41 | 42 | @OptIn(ExperimentalSerializationApi::class) 43 | fun main(args: Array) { 44 | val commandLineParser = CommandLineParser() 45 | commandLineParser.main(args) 46 | 47 | val outputLocation = "html-report" 48 | val report = json.decodeFromStream(FileInputStream(commandLineParser.input)) 49 | val reportConfig = ReportConfig( 50 | listOf( 51 | HtmlConfig( 52 | true, 53 | outputLocation, 54 | HtmlConfig.Script( 55 | commandLineParser.mermaidScriptSrc, 56 | commandLineParser.embed, 57 | HtmlConfig.Script.Options(commandLineParser.maxTextSize) 58 | ) 59 | ), 60 | ), 61 | ReportConfig.Marks(), 62 | false, 63 | ) 64 | ReportCreator(logger).createReports( 65 | report, 66 | reportConfig, 67 | File(commandLineParser.outputDir), 68 | commandLineParser.taskName 69 | ) 70 | } 71 | -------------------------------------------------------------------------------- /src/functionalTest/resources/MySpec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Ignore 2 | import spock.lang.Specification 3 | 4 | 5 | class MySpec extends Specification { 6 | 7 | public static final int sleepDurationMs = 10 8 | 9 | def "test 1"() { 10 | expect: 11 | true 12 | } 13 | 14 | @Ignore 15 | def "test 2"() { 16 | sleep sleepDurationMs 17 | expect: 18 | false 19 | } 20 | 21 | def "test 3"() { 22 | sleep sleepDurationMs 23 | expect: 24 | true 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /src/functionalTest/resources/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'groovy' 3 | id 'io.github.platan.tests-execution-chart' 4 | } 5 | createTestsExecutionReport { 6 | formats { 7 | html { enabled = true } 8 | json { enabled = true } 9 | mermaid { enabled = true } 10 | } 11 | } 12 | repositories { 13 | mavenCentral() 14 | } 15 | dependencies { 16 | testImplementation 'org.codehaus.groovy:groovy-all:3.0.10' 17 | testImplementation platform('org.spockframework:spock-bom:2.1-groovy-3.0') 18 | testImplementation 'org.spockframework:spock-core' 19 | } 20 | test { 21 | useJUnitPlatform() 22 | } 23 | -------------------------------------------------------------------------------- /src/functionalTest/resources/report-visual-regression.json: -------------------------------------------------------------------------------- 1 | { 2 | "results": [ 3 | { 4 | "className": "Test2Spec", 5 | "durationMs": 1, 6 | "endTime": 1679338714340, 7 | "startTime": 1679338714339, 8 | "resultType": "SKIPPED", 9 | "testName": "test 2", 10 | "type": "TEST" 11 | }, 12 | { 13 | "className": "Test1Spec", 14 | "durationMs": 1, 15 | "endTime": 1679338714340, 16 | "startTime": 1679338714339, 17 | "resultType": "SKIPPED", 18 | "testName": "test 2", 19 | "type": "TEST" 20 | }, 21 | { 22 | "className": "Test1Spec", 23 | "durationMs": 222, 24 | "endTime": 1679338714560, 25 | "startTime": 1679338714338, 26 | "resultType": "SUCCESS", 27 | "testName": "test 1", 28 | "type": "TEST" 29 | }, 30 | { 31 | "className": "Test1Spec", 32 | "durationMs": 234, 33 | "endTime": 1679338714572, 34 | "startTime": 1679338714338, 35 | "resultType": "FAILURE", 36 | "testName": "test 3", 37 | "type": "TEST" 38 | }, 39 | { 40 | "className": "Test2Spec", 41 | "durationMs": 320, 42 | "endTime": 1679338714659, 43 | "startTime": 1679338714339, 44 | "resultType": "SUCCESS", 45 | "testName": "test 1", 46 | "type": "TEST" 47 | }, 48 | { 49 | "className": "Test2Spec", 50 | "durationMs": 301, 51 | "endTime": 1679338714666, 52 | "startTime": 1679338714365, 53 | "resultType": "SUCCESS", 54 | "testName": "test 3 x=a", 55 | "type": "TEST" 56 | }, 57 | { 58 | "className": "Test2Spec", 59 | "durationMs": 303, 60 | "endTime": 1679338714669, 61 | "startTime": 1679338714366, 62 | "resultType": "SUCCESS", 63 | "testName": "test 3 x=b", 64 | "type": "TEST" 65 | }, 66 | { 67 | "className": "TestIsolatedSpec", 68 | "durationMs": 103, 69 | "endTime": 1679338714777, 70 | "startTime": 1679338714674, 71 | "resultType": "SUCCESS", 72 | "testName": "test 1", 73 | "type": "TEST" 74 | }, 75 | { 76 | "className": "TestIsolatedSpec", 77 | "durationMs": 101, 78 | "endTime": 1679338714878, 79 | "startTime": 1679338714777, 80 | "resultType": "SUCCESS", 81 | "testName": "test 2", 82 | "type": "TEST" 83 | }, 84 | { 85 | "className": "TestIsolatedSpec", 86 | "durationMs": 103, 87 | "endTime": 1679338714982, 88 | "startTime": 1679338714879, 89 | "resultType": "SUCCESS", 90 | "testName": "test 3", 91 | "type": "TEST" 92 | } 93 | ], 94 | "marks": [ 95 | { 96 | "timestamp": 1679338714982, 97 | "name": "total time of all tests" 98 | } 99 | ] 100 | } -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/CreateTestsExecutionReportExtension.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart 2 | 3 | import io.github.platan.tests_execution_chart.gradle.config.Components 4 | import io.github.platan.tests_execution_chart.gradle.config.Marks 5 | import io.github.platan.tests_execution_chart.gradle.config.formats.Formats 6 | import org.gradle.api.Action 7 | import org.gradle.api.model.ObjectFactory 8 | import org.gradle.api.provider.Property 9 | import org.gradle.api.tasks.Input 10 | import org.gradle.api.tasks.Nested 11 | import javax.inject.Inject 12 | 13 | abstract class CreateTestsExecutionReportExtension @Inject constructor(objectFactory: ObjectFactory) { 14 | 15 | @Nested 16 | abstract fun getFormats(): Formats 17 | 18 | @Nested 19 | abstract fun getMarks(): Marks 20 | 21 | @Nested 22 | abstract fun getComponents(): Components 23 | 24 | @get:Input 25 | val shiftTimestampsToStartOfDay: Property = objectFactory.property(Boolean::class.java).convention(false) 26 | 27 | open fun formats(action: Action) { 28 | action.execute(getFormats()) 29 | } 30 | 31 | open fun marks(action: Action) { 32 | action.execute(getMarks()) 33 | } 34 | 35 | open fun components(action: Action) { 36 | action.execute(getComponents()) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/CreateTestsExecutionReportTask.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle 2 | 3 | import io.github.platan.tests_execution_chart.gradle.config.Marks 4 | import io.github.platan.tests_execution_chart.gradle.config.formats.Formats 5 | import io.github.platan.tests_execution_chart.report.ReportConfig 6 | import io.github.platan.tests_execution_chart.report.ReportCreator 7 | import io.github.platan.tests_execution_chart.reporters.Logger 8 | import org.gradle.api.DefaultTask 9 | import org.gradle.api.model.ObjectFactory 10 | import org.gradle.api.provider.Property 11 | import org.gradle.api.tasks.Input 12 | import org.gradle.api.tasks.Internal 13 | import org.gradle.api.tasks.Nested 14 | import org.gradle.api.tasks.TaskAction 15 | import javax.inject.Inject 16 | 17 | private const val NO_REPORTS_MESSAGE = 18 | "Task was run but it hasn't created any reports. Possible reasons:\n" + 19 | "- 'test' task was not run together with 'createTestsExecutionReport' task\n" + 20 | "- there were no tests in module\n" + 21 | "- plugin 'tests-execution-chart' was not added to module with tests\n" + 22 | "- tests weren't run (were up-to-date) - force running tests by '--rerun-tasks' Gradle option" 23 | 24 | abstract class CreateTestsExecutionReportTask @Inject constructor(objectFactory: ObjectFactory) : DefaultTask() { 25 | 26 | private val customLogger = object : Logger { 27 | override fun lifecycle(message: String) { 28 | logger.lifecycle(message) 29 | } 30 | } 31 | 32 | @Internal 33 | abstract fun getRegisterService(): Property 34 | 35 | @Nested 36 | abstract fun getFormats(): Formats 37 | 38 | @Nested 39 | abstract fun getMarks(): Marks 40 | 41 | @get:Input 42 | val shiftTimestampsToStartOfDay: Property = objectFactory.property(Boolean::class.java).convention(false) 43 | 44 | @TaskAction 45 | fun printReport() { 46 | val resultsForAllModules = getRegisterService().get().getResults(this.identityPath.parent) 47 | if (resultsForAllModules.isEmpty()) { 48 | logger.lifecycle(NO_REPORTS_MESSAGE) 49 | } else { 50 | val reportConfig = ReportConfig( 51 | getFormats().toFormatsList(), 52 | getMarks().toMarks(), 53 | shiftTimestampsToStartOfDay.get() 54 | ) 55 | resultsForAllModules.forEach { (task, results) -> 56 | ReportCreator(customLogger).createReports(results, reportConfig, task.project.buildDir, task.name) 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/TestExecutionResultsRegisterService.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle 2 | 3 | import io.github.platan.tests_execution_chart.report.TestExecutionScheduleReportBuilder 4 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 5 | import io.github.platan.tests_execution_chart.report.data.TimedTestResult 6 | import org.gradle.api.services.BuildService 7 | import org.gradle.api.services.BuildServiceParameters 8 | import org.gradle.api.tasks.testing.Test 9 | import org.gradle.util.Path 10 | 11 | abstract class TestExecutionResultsRegisterService : BuildService { 12 | 13 | private val register = RegisterClass() 14 | 15 | class RegisterClass { 16 | var results: MutableMap = mutableMapOf() 17 | fun add( 18 | task: Test, 19 | className: String?, 20 | testName: String, 21 | startTime: Long, 22 | endTime: Long, 23 | resultType: String, 24 | type: TimedTestResult.Type 25 | ) { 26 | val reportBuilder = results.getOrPut(task) { TestExecutionScheduleReportBuilder() } 27 | reportBuilder.addResult(className, testName, startTime, endTime, resultType, type) 28 | } 29 | } 30 | 31 | fun getRegister(): RegisterClass { 32 | return register 33 | } 34 | 35 | fun getResults(module: Path?): Map { 36 | val reportBuilders = 37 | if (module == null) register.results else register.results.filterKeys { it.identityPath.parent == module } 38 | return reportBuilders.mapValues { it.value.build() } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/TestExecutionScheduleTestListener.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle 2 | 3 | import io.github.platan.tests_execution_chart.report.data.TimedTestResult 4 | import org.gradle.api.provider.Property 5 | import org.gradle.api.provider.Provider 6 | import org.gradle.api.tasks.testing.Test 7 | import org.gradle.api.tasks.testing.TestDescriptor 8 | import org.gradle.api.tasks.testing.TestListener 9 | import org.gradle.api.tasks.testing.TestResult 10 | 11 | class TestExecutionScheduleTestListener( 12 | private val service: Provider, 13 | private val task: Test, 14 | private val suitesEnabled: Property 15 | ) : 16 | TestListener { 17 | 18 | override fun beforeSuite(suite: TestDescriptor) { 19 | } 20 | 21 | override fun afterSuite(suite: TestDescriptor, result: TestResult) { 22 | if (suitesEnabled.get()) { 23 | service.get().getRegister().add( 24 | task, 25 | suite.name, 26 | "suite", 27 | result.startTime, 28 | result.endTime, 29 | result.resultType.toString(), 30 | TimedTestResult.Type.SUITE 31 | ) 32 | } 33 | } 34 | 35 | override fun beforeTest(testDescriptor: TestDescriptor) { 36 | } 37 | 38 | override fun afterTest(testDescriptor: TestDescriptor, testResult: TestResult) { 39 | service.get().getRegister().add( 40 | task, 41 | testDescriptor.className, 42 | testDescriptor.name, 43 | testResult.startTime, 44 | testResult.endTime, 45 | testResult.resultType.toString(), 46 | TimedTestResult.Type.TEST 47 | ) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/TestsExecutionReportPlugin.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle 2 | 3 | import io.github.platan.tests_execution_chart.CreateTestsExecutionReportExtension 4 | import org.gradle.api.Plugin 5 | import org.gradle.api.Project 6 | import org.gradle.api.provider.Provider 7 | import org.gradle.api.tasks.testing.Test 8 | 9 | class TestsExecutionReportPlugin : Plugin { 10 | override fun apply(project: Project) { 11 | val serviceProvider: Provider = 12 | project.gradle.sharedServices.registerIfAbsent( 13 | "testExecutionResultsRegisterService", 14 | TestExecutionResultsRegisterService::class.java 15 | ) {} 16 | 17 | val createTestsExecutionReportExtension = 18 | project.extensions.create("createTestsExecutionReport", CreateTestsExecutionReportExtension::class.java) 19 | project.tasks.register("createTestsExecutionReport", CreateTestsExecutionReportTask::class.java) { task -> 20 | configure(task, createTestsExecutionReportExtension) 21 | task.getRegisterService().set(serviceProvider) 22 | task.usesService(serviceProvider) 23 | task.outputs.upToDateWhen { false } 24 | task.setMustRunAfter(project.tasks.withType(Test::class.java)) 25 | } 26 | project.tasks.withType(Test::class.java) { task -> 27 | val suitesEnabled = createTestsExecutionReportExtension.getComponents().getSuites().enabled 28 | task.addTestListener(TestExecutionScheduleTestListener(serviceProvider, task, suitesEnabled)) 29 | } 30 | } 31 | 32 | private fun configure( 33 | task: CreateTestsExecutionReportTask, 34 | createTestsExecutionReportExtension: CreateTestsExecutionReportExtension 35 | ) { 36 | task.getFormats().getHtml().outputLocation 37 | .set(createTestsExecutionReportExtension.getFormats().getHtml().outputLocation) 38 | task.getFormats().getHtml().getScript().getConfig() 39 | .maxTextSize.set( 40 | createTestsExecutionReportExtension.getFormats().getHtml().getScript().getConfig().maxTextSize 41 | ) 42 | task.getFormats().getHtml().getScript().src 43 | .set(createTestsExecutionReportExtension.getFormats().getHtml().getScript().src) 44 | task.getFormats().getHtml().getScript().embed 45 | .set(createTestsExecutionReportExtension.getFormats().getHtml().getScript().embed) 46 | task.getFormats().getJson().outputLocation 47 | .set(createTestsExecutionReportExtension.getFormats().getJson().outputLocation) 48 | task.getFormats().getJson().enabled 49 | .set(createTestsExecutionReportExtension.getFormats().getJson().enabled) 50 | task.getFormats().getMermaid().enabled 51 | .set(createTestsExecutionReportExtension.getFormats().getMermaid().enabled) 52 | task.getFormats().getMermaid().outputLocation 53 | .set(createTestsExecutionReportExtension.getFormats().getMermaid().outputLocation) 54 | 55 | task.shiftTimestampsToStartOfDay.set(createTestsExecutionReportExtension.shiftTimestampsToStartOfDay) 56 | task.getMarks().getTotalTimeOfAllTests().enabled.set( 57 | createTestsExecutionReportExtension.getMarks().getTotalTimeOfAllTests().enabled 58 | ) 59 | val name = createTestsExecutionReportExtension.getMarks().getTotalTimeOfAllTests().name.get() 60 | require(name.isNotBlank()) { "marks.totalTimeOfAllTests.name cannot be blank" } 61 | task.getMarks().getTotalTimeOfAllTests().name.set(name) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/config/Components.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle.config 2 | 3 | import io.github.platan.tests_execution_chart.gradle.config.formats.Suites 4 | import org.gradle.api.Action 5 | import org.gradle.api.tasks.Nested 6 | 7 | abstract class Components { 8 | 9 | @Nested 10 | abstract fun getSuites(): Suites 11 | 12 | open fun suites(action: Action) { 13 | action.execute(getSuites()) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/config/Mark.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle.config 2 | 3 | import io.github.platan.tests_execution_chart.report.ReportConfig 4 | import org.gradle.api.model.ObjectFactory 5 | import org.gradle.api.provider.Property 6 | import org.gradle.api.tasks.Input 7 | import javax.inject.Inject 8 | 9 | abstract class Mark @Inject constructor(objectFactory: ObjectFactory, name: String) { 10 | 11 | @get:Input 12 | val enabled: Property = objectFactory.property(Boolean::class.java).convention(false) 13 | 14 | @get:Input 15 | val name: Property = objectFactory.property(String::class.java).convention(name) 16 | 17 | fun toMark(): ReportConfig.Marks.Mark = ReportConfig.Marks.Mark(enabled.get(), name.get()) 18 | } 19 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/config/Marks.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle.config 2 | 3 | import io.github.platan.tests_execution_chart.report.ReportConfig 4 | import org.gradle.api.Action 5 | import org.gradle.api.tasks.Nested 6 | 7 | abstract class Marks { 8 | 9 | @Nested 10 | abstract fun getTotalTimeOfAllTests(): TotalTimeOfAllTestsMark 11 | 12 | open fun totalTimeOfAllTests(action: Action) { 13 | action.execute(getTotalTimeOfAllTests()) 14 | } 15 | 16 | fun toMarks(): ReportConfig.Marks = 17 | ReportConfig.Marks(getTotalTimeOfAllTests().toMark()) 18 | } 19 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/config/TotalTimeOfAllTestsMark.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle.config 2 | 3 | import org.gradle.api.model.ObjectFactory 4 | import javax.inject.Inject 5 | 6 | abstract class TotalTimeOfAllTestsMark @Inject constructor(objectFactory: ObjectFactory) : 7 | Mark(objectFactory, "total time of all tests") 8 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/config/formats/Format.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle.config.formats 2 | 3 | import org.gradle.api.model.ObjectFactory 4 | import org.gradle.api.provider.Property 5 | import org.gradle.api.tasks.Input 6 | import org.gradle.api.tasks.Internal 7 | import javax.inject.Inject 8 | 9 | abstract class Format @Inject constructor(objectFactory: ObjectFactory, name: String) { 10 | 11 | @get:Input 12 | val enabled: Property = objectFactory.property(Boolean::class.java).convention(true) 13 | 14 | @Internal 15 | val outputLocation: Property = 16 | objectFactory.property(String::class.java).convention("reports/tests-execution/$name") 17 | } 18 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/config/formats/Formats.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle.config.formats 2 | 3 | import io.github.platan.tests_execution_chart.gradle.config.formats.json.Json 4 | import io.github.platan.tests_execution_chart.gradle.config.formats.mermaid.Mermaid 5 | import io.github.platan.tests_execution_chart.report.ReportConfig 6 | import org.gradle.api.Action 7 | import org.gradle.api.tasks.Nested 8 | 9 | abstract class Formats { 10 | @Nested 11 | abstract fun getHtml(): Html 12 | 13 | @Nested 14 | abstract fun getJson(): Json 15 | 16 | @Nested 17 | abstract fun getMermaid(): Mermaid 18 | 19 | open fun html(action: Action) { 20 | action.execute(getHtml()) 21 | } 22 | 23 | open fun json(action: Action) { 24 | action.execute(getJson()) 25 | } 26 | 27 | open fun mermaid(action: Action) { 28 | action.execute(getMermaid()) 29 | } 30 | 31 | fun toFormatsList(): List = 32 | listOf(getMermaid().toMermaidConfig(), getHtml().toHtmlConfig(), getJson().toJsonConfig()) 33 | } 34 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/config/formats/Html.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle.config.formats 2 | 3 | import io.github.platan.tests_execution_chart.reporters.html.HtmlConfig 4 | import org.gradle.api.Action 5 | import org.gradle.api.model.ObjectFactory 6 | import org.gradle.api.tasks.Nested 7 | import javax.inject.Inject 8 | 9 | abstract class Html @Inject constructor(objectFactory: ObjectFactory) : Format(objectFactory, "html") { 10 | @Nested 11 | abstract fun getScript(): Script 12 | 13 | open fun script(action: Action) { 14 | action.execute(getScript()) 15 | } 16 | 17 | fun toHtmlConfig(): HtmlConfig = HtmlConfig( 18 | enabled.get(), 19 | outputLocation.get(), 20 | HtmlConfig.Script( 21 | getScript().src.get(), 22 | getScript().embed.get(), 23 | HtmlConfig.Script.Options(getScript().getConfig().maxTextSize.get()) 24 | ) 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/config/formats/Script.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle.config.formats 2 | 3 | import io.github.platan.tests_execution_chart.reporters.html.HtmlConfig 4 | import org.gradle.api.Action 5 | import org.gradle.api.model.ObjectFactory 6 | import org.gradle.api.provider.Property 7 | import org.gradle.api.tasks.Input 8 | import org.gradle.api.tasks.Nested 9 | import javax.inject.Inject 10 | 11 | abstract class Script @Inject constructor(objectFactory: ObjectFactory) { 12 | 13 | @get:Input 14 | val src: Property = objectFactory.property(String::class.java).convention(HtmlConfig.Script.getSrcDefault()) 15 | 16 | @get:Input 17 | val embed: Property = objectFactory.property(Boolean::class.java).convention(false) 18 | 19 | @Nested 20 | abstract fun getConfig(): ScriptConfig 21 | 22 | open fun config(action: Action) { 23 | action.execute(getConfig()) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/config/formats/ScriptConfig.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle.config.formats 2 | 3 | import org.gradle.api.model.ObjectFactory 4 | import org.gradle.api.provider.Property 5 | import org.gradle.api.tasks.Input 6 | import javax.inject.Inject 7 | 8 | private const val MAX_TEXT_SIZE = 50_000 9 | 10 | abstract class ScriptConfig @Inject constructor(objectFactory: ObjectFactory) { 11 | 12 | @get:Input 13 | val maxTextSize: Property = objectFactory.property(Int::class.java).convention(MAX_TEXT_SIZE) 14 | } 15 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/config/formats/Suites.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle.config.formats 2 | 3 | import org.gradle.api.model.ObjectFactory 4 | import org.gradle.api.provider.Property 5 | import org.gradle.api.tasks.Input 6 | import javax.inject.Inject 7 | 8 | abstract class Suites @Inject constructor(objectFactory: ObjectFactory) { 9 | 10 | @get:Input 11 | val enabled: Property = objectFactory.property(Boolean::class.java).convention(false) 12 | } 13 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/config/formats/json/Json.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle.config.formats.json 2 | 3 | import io.github.platan.tests_execution_chart.gradle.config.formats.Format 4 | import io.github.platan.tests_execution_chart.reporters.json.JsonConfig 5 | import org.gradle.api.model.ObjectFactory 6 | import javax.inject.Inject 7 | 8 | abstract class Json @Inject constructor(objectFactory: ObjectFactory) : Format(objectFactory, "json") { 9 | fun toJsonConfig(): JsonConfig = JsonConfig(enabled.get(), outputLocation.get()) 10 | } 11 | -------------------------------------------------------------------------------- /src/main/kotlin/io/github/platan/tests_execution_chart/gradle/config/formats/mermaid/Mermaid.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.gradle.config.formats.mermaid 2 | 3 | import io.github.platan.tests_execution_chart.gradle.config.formats.Format 4 | import io.github.platan.tests_execution_chart.reporters.mermaid.MermaidConfig 5 | import org.gradle.api.model.ObjectFactory 6 | import javax.inject.Inject 7 | 8 | abstract class Mermaid @Inject constructor(objectFactory: ObjectFactory) : Format(objectFactory, "mermaid") { 9 | fun toMermaidConfig(): MermaidConfig = MermaidConfig(enabled.get(), outputLocation.get()) 10 | } 11 | -------------------------------------------------------------------------------- /src/visual-regression/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | /test-results/ 3 | /playwright-report/ 4 | /playwright/.cache/ 5 | -------------------------------------------------------------------------------- /src/visual-regression/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "visual-regression", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": {}, 7 | "keywords": [], 8 | "author": "", 9 | "license": "MIT", 10 | "devDependencies": { 11 | "@percy/cli": "^1.21.0", 12 | "@percy/playwright": "^1.0.4", 13 | "@playwright/test": "^1.31.2", 14 | "serve": "^14.2.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/visual-regression/playwright.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig, devices } from '@playwright/test'; 2 | 3 | /** 4 | * Read environment variables from file. 5 | * https://github.com/motdotla/dotenv 6 | */ 7 | // require('dotenv').config(); 8 | 9 | /** 10 | * See https://playwright.dev/docs/test-configuration. 11 | */ 12 | export default defineConfig({ 13 | testDir: './tests', 14 | /* Maximum time one test can run for. */ 15 | timeout: 30 * 1000, 16 | expect: { 17 | /** 18 | * Maximum time expect() should wait for the condition to be met. 19 | * For example in `await expect(locator).toHaveText();` 20 | */ 21 | timeout: 5000 22 | }, 23 | /* Run tests in files in parallel */ 24 | fullyParallel: true, 25 | /* Fail the build on CI if you accidentally left test.only in the source code. */ 26 | forbidOnly: !!process.env.CI, 27 | /* Retry on CI only */ 28 | retries: process.env.CI ? 2 : 0, 29 | /* Opt out of parallel tests on CI. */ 30 | workers: process.env.CI ? 1 : undefined, 31 | /* Reporter to use. See https://playwright.dev/docs/test-reporters */ 32 | reporter: 'html', 33 | /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ 34 | use: { 35 | /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ 36 | actionTimeout: 0, 37 | /* Base URL to use in actions like `await page.goto('/')`. */ 38 | // baseURL: 'http://localhost:3000', 39 | 40 | /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ 41 | trace: 'on-first-retry', 42 | }, 43 | 44 | /* Configure projects for major browsers */ 45 | projects: [ 46 | // { 47 | // name: 'chromium', 48 | // use: { ...devices['Desktop Chrome'] }, 49 | // }, 50 | 51 | { 52 | name: 'firefox', 53 | use: { ...devices['Desktop Firefox'] }, 54 | }, 55 | 56 | // { 57 | // name: 'webkit', 58 | // use: { ...devices['Desktop Safari'] }, 59 | // }, 60 | 61 | /* Test against mobile viewports. */ 62 | // { 63 | // name: 'Mobile Chrome', 64 | // use: { ...devices['Pixel 5'] }, 65 | // }, 66 | // { 67 | // name: 'Mobile Safari', 68 | // use: { ...devices['iPhone 12'] }, 69 | // }, 70 | 71 | /* Test against branded browsers. */ 72 | // { 73 | // name: 'Microsoft Edge', 74 | // use: { channel: 'msedge' }, 75 | // }, 76 | // { 77 | // name: 'Google Chrome', 78 | // use: { channel: 'chrome' }, 79 | // }, 80 | ], 81 | 82 | /* Folder for test artifacts such as screenshots, videos, traces, etc. */ 83 | // outputDir: 'test-results/', 84 | 85 | /* Run your local dev server before starting the tests */ 86 | // webServer: { 87 | // command: 'npm run start', 88 | // port: 3000, 89 | // }, 90 | }); 91 | -------------------------------------------------------------------------------- /src/visual-regression/tests/report.spec.ts: -------------------------------------------------------------------------------- 1 | import { test, expect } from '@playwright/test'; 2 | import percySnapshot from '@percy/playwright'; 3 | import handler from 'serve-handler'; 4 | import http from 'http'; 5 | 6 | const port = 3000; 7 | test.beforeEach(async ({ page }) => { 8 | const server = http.createServer((request, response) => { 9 | return handler(request, response, { public: '../../build/html-report' }); 10 | }); 11 | 12 | server.listen(port); 13 | }); 14 | 15 | 16 | test('open the report and take a screenshot', async ({ page }) => { 17 | await page.goto(`http://localhost:${port}/test.html`); 18 | 19 | await expect(page).toHaveTitle(/Test execution chart/); 20 | await percySnapshot(page, 'Test execution chart page'); 21 | }); 22 | -------------------------------------------------------------------------------- /test-projects.ps1: -------------------------------------------------------------------------------- 1 | foreach ($dir in Get-ChildItem test-projects -Directory) { 2 | Set-Location $dir 3 | .\gradlew $args 4 | Set-Location - 5 | } 6 | -------------------------------------------------------------------------------- /test-projects.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -x 4 | 5 | for dir in test-projects/* 6 | do 7 | if [ -d "$dir" ]; then 8 | cd "$dir" || exit 9 | ./gradlew "$@" || exit 10 | cd - || exit 11 | fi 12 | done 13 | -------------------------------------------------------------------------------- /test-projects/checks.gradle: -------------------------------------------------------------------------------- 1 | abstract class CheckReportsTask extends DefaultTask { 2 | @Input 3 | String jsonReport = 'build/reports/tests-execution/json/test.json' 4 | @Input 5 | String htmlReport = 'build/reports/tests-execution/html/test.html' 6 | @Input 7 | String mermaidReport = 'build/reports/tests-execution/mermaid/test.txt' 8 | 9 | @TaskAction 10 | def check() { 11 | logger.lifecycle("Verify that JSON report exists in $jsonReport") 12 | assert project.file(jsonReport).exists() 13 | logger.lifecycle("Verify that HTML report exists in $htmlReport") 14 | assert project.file(htmlReport).exists() 15 | logger.lifecycle("Verify that Mermaid report exists in $mermaidReport") 16 | assert project.file(mermaidReport).exists() 17 | } 18 | } 19 | 20 | tasks.register('checkReports', CheckReportsTask) 21 | -------------------------------------------------------------------------------- /test-projects/junit5-single-module/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | **/build/ 3 | !src/**/build/ 4 | 5 | # Ignore Gradle GUI config 6 | gradle-app.setting 7 | 8 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 9 | !gradle-wrapper.jar 10 | 11 | # Avoid ignore Gradle wrappper properties 12 | !gradle-wrapper.properties 13 | 14 | # Cache of project 15 | .gradletasknamecache 16 | 17 | # Eclipse Gradle plugin generated files 18 | # Eclipse Core 19 | .project 20 | # JDT-specific (Eclipse Java Development Tools) 21 | .classpath -------------------------------------------------------------------------------- /test-projects/junit5-single-module/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'io.github.platan.tests-execution-chart' 4 | } 5 | 6 | apply from: '../checks.gradle' 7 | 8 | repositories { 9 | mavenCentral() 10 | } 11 | 12 | dependencies { 13 | testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' 14 | testImplementation("org.junit.jupiter:junit-jupiter-params:5.8.1") 15 | testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' 16 | } 17 | 18 | test { 19 | useJUnitPlatform() 20 | } 21 | 22 | createTestsExecutionReport { 23 | formats { 24 | html { 25 | enabled = true 26 | } 27 | json { enabled = true } 28 | mermaid { enabled = true } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /test-projects/junit5-single-module/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/platan/tests-execution-chart/a76059793ac9f0f7721f4c3d7543efd16449135a/test-projects/junit5-single-module/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /test-projects/junit5-single-module/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /test-projects/junit5-single-module/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit 88 | 89 | # Use the maximum available, or set MAX_FD != -1 to use that value. 90 | MAX_FD=maximum 91 | 92 | warn () { 93 | echo "$*" 94 | } >&2 95 | 96 | die () { 97 | echo 98 | echo "$*" 99 | echo 100 | exit 1 101 | } >&2 102 | 103 | # OS specific support (must be 'true' or 'false'). 104 | cygwin=false 105 | msys=false 106 | darwin=false 107 | nonstop=false 108 | case "$( uname )" in #( 109 | CYGWIN* ) cygwin=true ;; #( 110 | Darwin* ) darwin=true ;; #( 111 | MSYS* | MINGW* ) msys=true ;; #( 112 | NONSTOP* ) nonstop=true ;; 113 | esac 114 | 115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 116 | 117 | 118 | # Determine the Java command to use to start the JVM. 119 | if [ -n "$JAVA_HOME" ] ; then 120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 121 | # IBM's JDK on AIX uses strange locations for the executables 122 | JAVACMD=$JAVA_HOME/jre/sh/java 123 | else 124 | JAVACMD=$JAVA_HOME/bin/java 125 | fi 126 | if [ ! -x "$JAVACMD" ] ; then 127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 128 | 129 | Please set the JAVA_HOME variable in your environment to match the 130 | location of your Java installation." 131 | fi 132 | else 133 | JAVACMD=java 134 | if ! command -v java >/dev/null 2>&1 135 | then 136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | fi 142 | 143 | # Increase the maximum file descriptors if we can. 144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 145 | case $MAX_FD in #( 146 | max*) 147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 148 | # shellcheck disable=SC2039,SC3045 149 | MAX_FD=$( ulimit -H -n ) || 150 | warn "Could not query maximum file descriptor limit" 151 | esac 152 | case $MAX_FD in #( 153 | '' | soft) :;; #( 154 | *) 155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 156 | # shellcheck disable=SC2039,SC3045 157 | ulimit -n "$MAX_FD" || 158 | warn "Could not set maximum file descriptor limit to $MAX_FD" 159 | esac 160 | fi 161 | 162 | # Collect all arguments for the java command, stacking in reverse order: 163 | # * args from the command line 164 | # * the main class name 165 | # * -classpath 166 | # * -D...appname settings 167 | # * --module-path (only if needed) 168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 169 | 170 | # For Cygwin or MSYS, switch paths to Windows format before running java 171 | if "$cygwin" || "$msys" ; then 172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 174 | 175 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 176 | 177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 178 | for arg do 179 | if 180 | case $arg in #( 181 | -*) false ;; # don't mess with options #( 182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 183 | [ -e "$t" ] ;; #( 184 | *) false ;; 185 | esac 186 | then 187 | arg=$( cygpath --path --ignore --mixed "$arg" ) 188 | fi 189 | # Roll the args list around exactly as many times as the number of 190 | # args, so each arg winds up back in the position where it started, but 191 | # possibly modified. 192 | # 193 | # NB: a `for` loop captures its iteration list before it begins, so 194 | # changing the positional parameters here affects neither the number of 195 | # iterations, nor the values presented in `arg`. 196 | shift # remove old arg 197 | set -- "$@" "$arg" # push replacement arg 198 | done 199 | fi 200 | 201 | 202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 204 | 205 | # Collect all arguments for the java command: 206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 207 | # and any embedded shellness will be escaped. 208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 209 | # treated as '${Hostname}' itself on the command line. 210 | 211 | set -- \ 212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 213 | -classpath "$CLASSPATH" \ 214 | org.gradle.wrapper.GradleWrapperMain \ 215 | "$@" 216 | 217 | # Stop when "xargs" is not available. 218 | if ! command -v xargs >/dev/null 2>&1 219 | then 220 | die "xargs is not available" 221 | fi 222 | 223 | # Use "xargs" to parse quoted args. 224 | # 225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 226 | # 227 | # In Bash we could simply go: 228 | # 229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 230 | # set -- "${ARGS[@]}" "$@" 231 | # 232 | # but POSIX shell has neither arrays nor command substitution, so instead we 233 | # post-process each arg (as a line of input to sed) to backslash-escape any 234 | # character that might be a shell metacharacter, then use eval to reverse 235 | # that process (while maintaining the separation between arguments), and wrap 236 | # the whole thing up as a single "set" statement. 237 | # 238 | # This will of course break if any of these variables contains a newline or 239 | # an unmatched quote. 240 | # 241 | 242 | eval "set -- $( 243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 244 | xargs -n1 | 245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 246 | tr '\n' ' ' 247 | )" '"$@"' 248 | 249 | exec "$JAVACMD" "$@" 250 | -------------------------------------------------------------------------------- /test-projects/junit5-single-module/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /test-projects/junit5-single-module/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'junit5-single-module' 2 | 3 | includeBuild('../..') 4 | -------------------------------------------------------------------------------- /test-projects/junit5-single-module/src/test/java/Test1Test.java: -------------------------------------------------------------------------------- 1 | import org.junit.jupiter.api.Disabled; 2 | import org.junit.jupiter.api.Test; 3 | 4 | class Test1Test { 5 | 6 | private static final int sleepDurationMs = 200; 7 | 8 | @Test 9 | public void test1() throws InterruptedException { 10 | Thread.sleep(sleepDurationMs); 11 | } 12 | 13 | @Test 14 | @Disabled 15 | public void test2() throws InterruptedException { 16 | Thread.sleep(sleepDurationMs); 17 | } 18 | 19 | @Test 20 | public void test3() throws InterruptedException { 21 | Thread.sleep(sleepDurationMs); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /test-projects/junit5-single-module/src/test/java/Test2Test.java: -------------------------------------------------------------------------------- 1 | import org.junit.jupiter.api.Disabled; 2 | import org.junit.jupiter.api.Test; 3 | import org.junit.jupiter.params.ParameterizedTest; 4 | import org.junit.jupiter.params.provider.ValueSource; 5 | 6 | class Test2Test { 7 | 8 | private static final int sleepDurationMs = 500; 9 | 10 | @Test 11 | public void test1() throws InterruptedException { 12 | Thread.sleep(sleepDurationMs); 13 | } 14 | 15 | @Test 16 | @Disabled 17 | public void test2() throws InterruptedException { 18 | Thread.sleep(sleepDurationMs); 19 | } 20 | 21 | @ParameterizedTest 22 | @ValueSource(strings = {"a", "b"}) 23 | public void test3() throws InterruptedException { 24 | Thread.sleep(sleepDurationMs); 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /test-projects/junit5-single-module/src/test/java/TestIsolatedSpec.java: -------------------------------------------------------------------------------- 1 | import org.junit.jupiter.api.Test; 2 | import org.junit.jupiter.api.parallel.Isolated; 3 | 4 | @Isolated 5 | class TestIsolatedSpec { 6 | 7 | private static final int sleepDurationMs = 50; 8 | 9 | @Test 10 | public void test1() throws InterruptedException { 11 | Thread.sleep(sleepDurationMs); 12 | } 13 | 14 | @Test 15 | public void test2() throws InterruptedException { 16 | Thread.sleep(sleepDurationMs); 17 | } 18 | 19 | @Test 20 | public void test3() throws InterruptedException { 21 | Thread.sleep(sleepDurationMs); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /test-projects/junit5-single-module/src/test/resources/junit-platform.properties: -------------------------------------------------------------------------------- 1 | junit.jupiter.execution.parallel.enabled=true 2 | junit.jupiter.execution.parallel.mode.default=concurrent 3 | -------------------------------------------------------------------------------- /test-projects/kotest-single-module/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | **/build/ 3 | !src/**/build/ 4 | 5 | # Ignore Gradle GUI config 6 | gradle-app.setting 7 | 8 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 9 | !gradle-wrapper.jar 10 | 11 | # Avoid ignore Gradle wrappper properties 12 | !gradle-wrapper.properties 13 | 14 | # Cache of project 15 | .gradletasknamecache 16 | 17 | # Eclipse Gradle plugin generated files 18 | # Eclipse Core 19 | .project 20 | # JDT-specific (Eclipse Java Development Tools) 21 | .classpath -------------------------------------------------------------------------------- /test-projects/kotest-single-module/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") version "1.7.10" 3 | id("io.github.platan.tests-execution-chart") 4 | } 5 | 6 | apply(from = "../checks.gradle") 7 | 8 | repositories { 9 | mavenCentral() 10 | } 11 | 12 | dependencies { 13 | testImplementation(kotlin("test")) 14 | testImplementation("io.kotest:kotest-runner-junit5:5.4.2") 15 | testImplementation("io.kotest:kotest-assertions-core:5.4.2") 16 | testImplementation("io.kotest:kotest-framework-datatest:5.4.2") 17 | } 18 | 19 | tasks.test { 20 | useJUnitPlatform() 21 | } 22 | 23 | 24 | configure { 25 | formats { 26 | html { 27 | } 28 | json { 29 | enabled.set(true) 30 | } 31 | mermaid { 32 | enabled.set(true) 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test-projects/kotest-single-module/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | -------------------------------------------------------------------------------- /test-projects/kotest-single-module/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/platan/tests-execution-chart/a76059793ac9f0f7721f4c3d7543efd16449135a/test-projects/kotest-single-module/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /test-projects/kotest-single-module/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /test-projects/kotest-single-module/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit 88 | 89 | # Use the maximum available, or set MAX_FD != -1 to use that value. 90 | MAX_FD=maximum 91 | 92 | warn () { 93 | echo "$*" 94 | } >&2 95 | 96 | die () { 97 | echo 98 | echo "$*" 99 | echo 100 | exit 1 101 | } >&2 102 | 103 | # OS specific support (must be 'true' or 'false'). 104 | cygwin=false 105 | msys=false 106 | darwin=false 107 | nonstop=false 108 | case "$( uname )" in #( 109 | CYGWIN* ) cygwin=true ;; #( 110 | Darwin* ) darwin=true ;; #( 111 | MSYS* | MINGW* ) msys=true ;; #( 112 | NONSTOP* ) nonstop=true ;; 113 | esac 114 | 115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 116 | 117 | 118 | # Determine the Java command to use to start the JVM. 119 | if [ -n "$JAVA_HOME" ] ; then 120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 121 | # IBM's JDK on AIX uses strange locations for the executables 122 | JAVACMD=$JAVA_HOME/jre/sh/java 123 | else 124 | JAVACMD=$JAVA_HOME/bin/java 125 | fi 126 | if [ ! -x "$JAVACMD" ] ; then 127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 128 | 129 | Please set the JAVA_HOME variable in your environment to match the 130 | location of your Java installation." 131 | fi 132 | else 133 | JAVACMD=java 134 | if ! command -v java >/dev/null 2>&1 135 | then 136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | fi 142 | 143 | # Increase the maximum file descriptors if we can. 144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 145 | case $MAX_FD in #( 146 | max*) 147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 148 | # shellcheck disable=SC2039,SC3045 149 | MAX_FD=$( ulimit -H -n ) || 150 | warn "Could not query maximum file descriptor limit" 151 | esac 152 | case $MAX_FD in #( 153 | '' | soft) :;; #( 154 | *) 155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 156 | # shellcheck disable=SC2039,SC3045 157 | ulimit -n "$MAX_FD" || 158 | warn "Could not set maximum file descriptor limit to $MAX_FD" 159 | esac 160 | fi 161 | 162 | # Collect all arguments for the java command, stacking in reverse order: 163 | # * args from the command line 164 | # * the main class name 165 | # * -classpath 166 | # * -D...appname settings 167 | # * --module-path (only if needed) 168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 169 | 170 | # For Cygwin or MSYS, switch paths to Windows format before running java 171 | if "$cygwin" || "$msys" ; then 172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 174 | 175 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 176 | 177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 178 | for arg do 179 | if 180 | case $arg in #( 181 | -*) false ;; # don't mess with options #( 182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 183 | [ -e "$t" ] ;; #( 184 | *) false ;; 185 | esac 186 | then 187 | arg=$( cygpath --path --ignore --mixed "$arg" ) 188 | fi 189 | # Roll the args list around exactly as many times as the number of 190 | # args, so each arg winds up back in the position where it started, but 191 | # possibly modified. 192 | # 193 | # NB: a `for` loop captures its iteration list before it begins, so 194 | # changing the positional parameters here affects neither the number of 195 | # iterations, nor the values presented in `arg`. 196 | shift # remove old arg 197 | set -- "$@" "$arg" # push replacement arg 198 | done 199 | fi 200 | 201 | 202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 204 | 205 | # Collect all arguments for the java command: 206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 207 | # and any embedded shellness will be escaped. 208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 209 | # treated as '${Hostname}' itself on the command line. 210 | 211 | set -- \ 212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 213 | -classpath "$CLASSPATH" \ 214 | org.gradle.wrapper.GradleWrapperMain \ 215 | "$@" 216 | 217 | # Stop when "xargs" is not available. 218 | if ! command -v xargs >/dev/null 2>&1 219 | then 220 | die "xargs is not available" 221 | fi 222 | 223 | # Use "xargs" to parse quoted args. 224 | # 225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 226 | # 227 | # In Bash we could simply go: 228 | # 229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 230 | # set -- "${ARGS[@]}" "$@" 231 | # 232 | # but POSIX shell has neither arrays nor command substitution, so instead we 233 | # post-process each arg (as a line of input to sed) to backslash-escape any 234 | # character that might be a shell metacharacter, then use eval to reverse 235 | # that process (while maintaining the separation between arguments), and wrap 236 | # the whole thing up as a single "set" statement. 237 | # 238 | # This will of course break if any of these variables contains a newline or 239 | # an unmatched quote. 240 | # 241 | 242 | eval "set -- $( 243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 244 | xargs -n1 | 245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 246 | tr '\n' ' ' 247 | )" '"$@"' 248 | 249 | exec "$JAVACMD" "$@" 250 | -------------------------------------------------------------------------------- /test-projects/kotest-single-module/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /test-projects/kotest-single-module/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "kotest-single-module" 2 | 3 | includeBuild("../..") 4 | -------------------------------------------------------------------------------- /test-projects/kotest-single-module/src/test/kotlin/KotestProjectConfig.kt: -------------------------------------------------------------------------------- 1 | import io.kotest.common.ExperimentalKotest 2 | import io.kotest.core.config.AbstractProjectConfig 3 | 4 | object KotestProjectConfig : AbstractProjectConfig() { 5 | @ExperimentalKotest 6 | override val concurrentSpecs = 4 7 | 8 | @ExperimentalKotest 9 | override val concurrentTests = 4 10 | } 11 | -------------------------------------------------------------------------------- /test-projects/kotest-single-module/src/test/kotlin/Test1.kt: -------------------------------------------------------------------------------- 1 | import io.kotest.core.spec.style.StringSpec 2 | import kotlinx.coroutines.delay 3 | 4 | private const val sleepDurationMs = 200L 5 | 6 | class Test1 : StringSpec({ 7 | 8 | "test 1" { 9 | delay(sleepDurationMs) 10 | } 11 | 12 | "test 2".config(enabled = false) { 13 | delay(sleepDurationMs) 14 | } 15 | 16 | "test 3" { 17 | delay(sleepDurationMs) 18 | } 19 | 20 | }) -------------------------------------------------------------------------------- /test-projects/kotest-single-module/src/test/kotlin/Test2.kt: -------------------------------------------------------------------------------- 1 | import io.kotest.core.spec.style.FunSpec 2 | import io.kotest.datatest.withData 3 | import kotlinx.coroutines.delay 4 | 5 | private const val sleepDurationMs = 500L 6 | 7 | class Test2 : FunSpec({ 8 | 9 | test("test 1") { 10 | delay(sleepDurationMs) 11 | } 12 | 13 | test("test 2") { 14 | delay(sleepDurationMs) 15 | } 16 | 17 | context("test 3") { 18 | withData( 19 | "a", "b" 20 | ) { 21 | delay(sleepDurationMs) 22 | } 23 | } 24 | }) -------------------------------------------------------------------------------- /test-projects/kotest-single-module/src/test/kotlin/TestIsolated.kt: -------------------------------------------------------------------------------- 1 | import io.kotest.core.annotation.Isolate 2 | import io.kotest.core.spec.style.StringSpec 3 | import kotlinx.coroutines.delay 4 | 5 | private const val sleepDurationMs = 50L 6 | 7 | @Isolate 8 | class TestIsolated : StringSpec({ 9 | 10 | "test 1" { 11 | delay(sleepDurationMs) 12 | } 13 | 14 | "test 2".config(enabled = false) { 15 | delay(sleepDurationMs) 16 | } 17 | 18 | "test 3" { 19 | delay(sleepDurationMs) 20 | } 21 | 22 | }) -------------------------------------------------------------------------------- /test-projects/spock-multi-module/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | **/build/ 3 | !module1/src/**/build/ 4 | 5 | # Ignore Gradle GUI config 6 | gradle-app.setting 7 | 8 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 9 | !gradle-wrapper.jar 10 | 11 | # Avoid ignore Gradle wrappper properties 12 | !gradle-wrapper.properties 13 | 14 | # Cache of project 15 | .gradletasknamecache 16 | 17 | # Eclipse Gradle plugin generated files 18 | # Eclipse Core 19 | .project 20 | # JDT-specific (Eclipse Java Development Tools) 21 | .classpath -------------------------------------------------------------------------------- /test-projects/spock-multi-module/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'groovy' 3 | id 'java' 4 | id 'io.github.platan.tests-execution-chart' 5 | } 6 | 7 | repositories { 8 | mavenCentral() 9 | } 10 | 11 | dependencies { 12 | testImplementation 'org.codehaus.groovy:groovy-all:3.0.10' 13 | testImplementation platform("org.spockframework:spock-bom:2.1-groovy-3.0") 14 | testImplementation "org.spockframework:spock-core" 15 | } 16 | 17 | test { 18 | useJUnitPlatform() 19 | } 20 | 21 | createTestsExecutionReport { 22 | formats { 23 | html { 24 | enabled = true 25 | } 26 | json { enabled = true } 27 | mermaid { enabled = true } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test-projects/spock-multi-module/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/platan/tests-execution-chart/a76059793ac9f0f7721f4c3d7543efd16449135a/test-projects/spock-multi-module/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /test-projects/spock-multi-module/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /test-projects/spock-multi-module/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit 88 | 89 | # Use the maximum available, or set MAX_FD != -1 to use that value. 90 | MAX_FD=maximum 91 | 92 | warn () { 93 | echo "$*" 94 | } >&2 95 | 96 | die () { 97 | echo 98 | echo "$*" 99 | echo 100 | exit 1 101 | } >&2 102 | 103 | # OS specific support (must be 'true' or 'false'). 104 | cygwin=false 105 | msys=false 106 | darwin=false 107 | nonstop=false 108 | case "$( uname )" in #( 109 | CYGWIN* ) cygwin=true ;; #( 110 | Darwin* ) darwin=true ;; #( 111 | MSYS* | MINGW* ) msys=true ;; #( 112 | NONSTOP* ) nonstop=true ;; 113 | esac 114 | 115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 116 | 117 | 118 | # Determine the Java command to use to start the JVM. 119 | if [ -n "$JAVA_HOME" ] ; then 120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 121 | # IBM's JDK on AIX uses strange locations for the executables 122 | JAVACMD=$JAVA_HOME/jre/sh/java 123 | else 124 | JAVACMD=$JAVA_HOME/bin/java 125 | fi 126 | if [ ! -x "$JAVACMD" ] ; then 127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 128 | 129 | Please set the JAVA_HOME variable in your environment to match the 130 | location of your Java installation." 131 | fi 132 | else 133 | JAVACMD=java 134 | if ! command -v java >/dev/null 2>&1 135 | then 136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | fi 142 | 143 | # Increase the maximum file descriptors if we can. 144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 145 | case $MAX_FD in #( 146 | max*) 147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 148 | # shellcheck disable=SC2039,SC3045 149 | MAX_FD=$( ulimit -H -n ) || 150 | warn "Could not query maximum file descriptor limit" 151 | esac 152 | case $MAX_FD in #( 153 | '' | soft) :;; #( 154 | *) 155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 156 | # shellcheck disable=SC2039,SC3045 157 | ulimit -n "$MAX_FD" || 158 | warn "Could not set maximum file descriptor limit to $MAX_FD" 159 | esac 160 | fi 161 | 162 | # Collect all arguments for the java command, stacking in reverse order: 163 | # * args from the command line 164 | # * the main class name 165 | # * -classpath 166 | # * -D...appname settings 167 | # * --module-path (only if needed) 168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 169 | 170 | # For Cygwin or MSYS, switch paths to Windows format before running java 171 | if "$cygwin" || "$msys" ; then 172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 174 | 175 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 176 | 177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 178 | for arg do 179 | if 180 | case $arg in #( 181 | -*) false ;; # don't mess with options #( 182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 183 | [ -e "$t" ] ;; #( 184 | *) false ;; 185 | esac 186 | then 187 | arg=$( cygpath --path --ignore --mixed "$arg" ) 188 | fi 189 | # Roll the args list around exactly as many times as the number of 190 | # args, so each arg winds up back in the position where it started, but 191 | # possibly modified. 192 | # 193 | # NB: a `for` loop captures its iteration list before it begins, so 194 | # changing the positional parameters here affects neither the number of 195 | # iterations, nor the values presented in `arg`. 196 | shift # remove old arg 197 | set -- "$@" "$arg" # push replacement arg 198 | done 199 | fi 200 | 201 | 202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 204 | 205 | # Collect all arguments for the java command: 206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 207 | # and any embedded shellness will be escaped. 208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 209 | # treated as '${Hostname}' itself on the command line. 210 | 211 | set -- \ 212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 213 | -classpath "$CLASSPATH" \ 214 | org.gradle.wrapper.GradleWrapperMain \ 215 | "$@" 216 | 217 | # Stop when "xargs" is not available. 218 | if ! command -v xargs >/dev/null 2>&1 219 | then 220 | die "xargs is not available" 221 | fi 222 | 223 | # Use "xargs" to parse quoted args. 224 | # 225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 226 | # 227 | # In Bash we could simply go: 228 | # 229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 230 | # set -- "${ARGS[@]}" "$@" 231 | # 232 | # but POSIX shell has neither arrays nor command substitution, so instead we 233 | # post-process each arg (as a line of input to sed) to backslash-escape any 234 | # character that might be a shell metacharacter, then use eval to reverse 235 | # that process (while maintaining the separation between arguments), and wrap 236 | # the whole thing up as a single "set" statement. 237 | # 238 | # This will of course break if any of these variables contains a newline or 239 | # an unmatched quote. 240 | # 241 | 242 | eval "set -- $( 243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 244 | xargs -n1 | 245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 246 | tr '\n' ' ' 247 | )" '"$@"' 248 | 249 | exec "$JAVACMD" "$@" 250 | -------------------------------------------------------------------------------- /test-projects/spock-multi-module/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /test-projects/spock-multi-module/module1/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'groovy' 3 | id 'java' 4 | id 'io.github.platan.tests-execution-chart' 5 | } 6 | 7 | apply from: '../../checks.gradle' 8 | 9 | repositories { 10 | mavenCentral() 11 | } 12 | 13 | dependencies { 14 | testImplementation 'org.codehaus.groovy:groovy-all:3.0.10' 15 | testImplementation platform("org.spockframework:spock-bom:2.1-groovy-3.0") 16 | testImplementation "org.spockframework:spock-core" 17 | } 18 | 19 | test { 20 | useJUnitPlatform() 21 | } 22 | 23 | createTestsExecutionReport { 24 | formats { 25 | html { 26 | enabled = true 27 | } 28 | json { enabled = true } 29 | mermaid { enabled = true } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test-projects/spock-multi-module/module1/src/test/groovy/Test1Spec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Ignore 2 | import spock.lang.Specification 3 | 4 | 5 | class Test1Spec extends Specification { 6 | 7 | private static final int sleepDuration = 200 8 | 9 | def "test 1"() { 10 | sleep sleepDuration 11 | expect: 12 | true 13 | } 14 | 15 | @Ignore 16 | def "test 2"() { 17 | sleep sleepDuration 18 | expect: 19 | false 20 | } 21 | 22 | def "test 3"() { 23 | sleep sleepDuration 24 | expect: 25 | true 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /test-projects/spock-multi-module/module1/src/test/groovy/Test2Spec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Ignore 2 | import spock.lang.Specification 3 | import spock.lang.Unroll 4 | 5 | 6 | class Test2Spec extends Specification { 7 | 8 | private static final int sleepDuration = 500 9 | 10 | def "test 1"() { 11 | sleep sleepDuration 12 | expect: true 13 | } 14 | 15 | @Ignore 16 | def "test 2"() { 17 | sleep sleepDuration 18 | expect: true 19 | 20 | } 21 | 22 | @Unroll 23 | def "test 3 x=#x"() { 24 | sleep sleepDuration 25 | expect: true 26 | where: 27 | x << ['a', 'b'] 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /test-projects/spock-multi-module/module1/src/test/groovy/TestIsolatedSpec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Isolated 2 | import spock.lang.Specification 3 | 4 | @Isolated 5 | class TestIsolatedSpec extends Specification { 6 | 7 | private static final int sleepDuration = 50 8 | 9 | def "test 1"() { 10 | sleep sleepDuration 11 | expect: 12 | true 13 | } 14 | 15 | def "test 2"() { 16 | sleep sleepDuration 17 | expect: 18 | true 19 | } 20 | 21 | def "test 3"() { 22 | sleep sleepDuration 23 | expect: 24 | true 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /test-projects/spock-multi-module/module1/src/test/resources/SpockConfig.groovy: -------------------------------------------------------------------------------- 1 | runner { 2 | parallel { 3 | enabled true 4 | } 5 | } -------------------------------------------------------------------------------- /test-projects/spock-multi-module/module2/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'groovy' 3 | id 'java' 4 | id 'io.github.platan.tests-execution-chart' 5 | } 6 | 7 | apply from: '../../checks.gradle' 8 | 9 | repositories { 10 | mavenCentral() 11 | } 12 | 13 | dependencies { 14 | testImplementation 'org.codehaus.groovy:groovy-all:3.0.10' 15 | testImplementation platform("org.spockframework:spock-bom:2.1-groovy-3.0") 16 | testImplementation "org.spockframework:spock-core" 17 | } 18 | 19 | test { 20 | useJUnitPlatform() 21 | } 22 | 23 | createTestsExecutionReport { 24 | formats { 25 | html { 26 | enabled = true 27 | } 28 | json { enabled = true } 29 | mermaid { enabled = true } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test-projects/spock-multi-module/module2/src/test/groovy/Test1Spec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Ignore 2 | import spock.lang.Specification 3 | 4 | 5 | class Test1Spec extends Specification { 6 | 7 | private static final int sleepDuration = 200 8 | 9 | def "test 1"() { 10 | sleep sleepDuration 11 | expect: 12 | true 13 | } 14 | 15 | @Ignore 16 | def "test 2"() { 17 | sleep sleepDuration 18 | expect: 19 | false 20 | } 21 | 22 | def "test 3"() { 23 | sleep sleepDuration 24 | expect: 25 | true 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /test-projects/spock-multi-module/module2/src/test/groovy/Test2Spec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Ignore 2 | import spock.lang.Specification 3 | import spock.lang.Unroll 4 | 5 | 6 | class Test2Spec extends Specification { 7 | 8 | private static final int sleepDuration = 500 9 | 10 | def "test 1"() { 11 | sleep sleepDuration 12 | expect: 13 | true 14 | } 15 | 16 | @Ignore 17 | def "test 2"() { 18 | sleep sleepDuration 19 | expect: 20 | true 21 | 22 | } 23 | 24 | @Unroll 25 | def "test 3 x=#x"() { 26 | sleep sleepDuration 27 | expect: 28 | true 29 | where: 30 | x << ['a', 'b'] 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /test-projects/spock-multi-module/module2/src/test/groovy/TestIsolatedSpec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Isolated 2 | import spock.lang.Specification 3 | 4 | @Isolated 5 | class TestIsolatedSpec extends Specification { 6 | 7 | private static final int sleepDuration = 50 8 | 9 | def "test 1"() { 10 | sleep sleepDuration 11 | expect: 12 | true 13 | } 14 | 15 | def "test 2"() { 16 | sleep sleepDuration 17 | expect: 18 | true 19 | } 20 | 21 | def "test 3"() { 22 | sleep sleepDuration 23 | expect: 24 | true 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /test-projects/spock-multi-module/module2/src/test/resources/SpockConfig.groovy: -------------------------------------------------------------------------------- 1 | runner { 2 | parallel { 3 | enabled true 4 | } 5 | } -------------------------------------------------------------------------------- /test-projects/spock-multi-module/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'spock-multi-module' 2 | 3 | include 'module1' 4 | include 'module2' 5 | 6 | includeBuild('../..') 7 | -------------------------------------------------------------------------------- /test-projects/spock-multi-module/src/test/groovy/MySpec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Ignore 2 | import spock.lang.Specification 3 | 4 | 5 | class MySpec extends Specification { 6 | 7 | public static final int sleepDurationMs = 101 8 | 9 | def "test 11111"() { 10 | sleep sleepDurationMs 11 | expect: 12 | true 13 | } 14 | 15 | @Ignore 16 | def "test 2"() { 17 | sleep sleepDurationMs 18 | expect: 19 | false 20 | } 21 | 22 | def "test 3"() { 23 | sleep sleepDurationMs 24 | expect: 25 | true 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /test-projects/spock-multi-module/src/test/groovy/Test1Spec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Ignore 2 | import spock.lang.Specification 3 | 4 | 5 | class Test1Spec extends Specification { 6 | 7 | public static final int sleepDuration = 200 8 | 9 | def "test 1"() { 10 | sleep sleepDuration 11 | expect: 12 | true 13 | } 14 | 15 | @Ignore 16 | def "test 2.a"() { 17 | sleep sleepDuration 18 | expect: 19 | false 20 | } 21 | 22 | def "test 3"() { 23 | sleep sleepDuration 24 | expect: 25 | true 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /test-projects/spock-multi-module/src/test/groovy/Test2Spec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Ignore 2 | import spock.lang.Specification 3 | import spock.lang.Unroll 4 | 5 | 6 | class Test2Spec extends Specification { 7 | 8 | public static final int sleepDuration = 500 9 | 10 | def "test 1"() { 11 | sleep sleepDuration 12 | expect: 13 | true 14 | } 15 | 16 | @Ignore 17 | def "test 2"() { 18 | sleep sleepDuration 19 | expect: 20 | true 21 | 22 | } 23 | 24 | @Unroll 25 | def "test 3 x=#x"() { 26 | sleep sleepDuration 27 | expect: 28 | true 29 | where: 30 | x = 2 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /test-projects/spock-multi-module/src/test/groovy/TestIsolatedSpec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Isolated 2 | import spock.lang.Specification 3 | 4 | @Isolated 5 | class TestIsolatedSpec extends Specification { 6 | 7 | public static final int sleepDuration = 50 8 | 9 | def "test 1"() { 10 | sleep sleepDuration 11 | expect: 12 | true 13 | } 14 | 15 | def "test 2"() { 16 | sleep sleepDuration 17 | expect: 18 | true 19 | } 20 | 21 | def "test 3"() { 22 | sleep sleepDuration 23 | expect: 24 | true 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /test-projects/spock-multi-module/src/test/resources/SpockConfig.groovy: -------------------------------------------------------------------------------- 1 | runner { 2 | parallel { 3 | enabled true 4 | } 5 | } -------------------------------------------------------------------------------- /test-projects/spock-multiple-test-tasks/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | **/build/ 3 | !src/**/build/ 4 | 5 | # Ignore Gradle GUI config 6 | gradle-app.setting 7 | 8 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 9 | !gradle-wrapper.jar 10 | 11 | # Avoid ignore Gradle wrappper properties 12 | !gradle-wrapper.properties 13 | 14 | # Cache of project 15 | .gradletasknamecache 16 | 17 | # Eclipse Gradle plugin generated files 18 | # Eclipse Core 19 | .project 20 | # JDT-specific (Eclipse Java Development Tools) 21 | .classpath -------------------------------------------------------------------------------- /test-projects/spock-multiple-test-tasks/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'groovy' 3 | id 'java' 4 | id 'io.github.platan.tests-execution-chart' 5 | } 6 | 7 | apply from: '../checks.gradle' 8 | 9 | repositories { 10 | mavenCentral() 11 | } 12 | 13 | // based on https://docs.gradle.org/current/userguide/java_testing.html#sec:configuring_java_integration_tests 14 | sourceSets { 15 | intTest { 16 | compileClasspath += sourceSets.main.output 17 | runtimeClasspath += sourceSets.main.output 18 | } 19 | } 20 | 21 | configurations { 22 | intTestImplementation.extendsFrom implementation 23 | intTestRuntimeOnly.extendsFrom runtimeOnly 24 | } 25 | 26 | dependencies { 27 | intTestImplementation 'org.codehaus.groovy:groovy-all:3.0.10' 28 | intTestImplementation platform("org.spockframework:spock-bom:2.1-groovy-3.0") 29 | intTestImplementation "org.spockframework:spock-core" 30 | } 31 | 32 | tasks.register('integrationTest', Test) { 33 | description = 'Runs integration tests.' 34 | group = 'verification' 35 | 36 | testClassesDirs = sourceSets.intTest.output.classesDirs 37 | classpath = sourceSets.intTest.runtimeClasspath 38 | useJUnitPlatform() 39 | } 40 | 41 | test.dependsOn integrationTest 42 | check.dependsOn integrationTest 43 | 44 | createTestsExecutionReport { 45 | formats { 46 | html { 47 | enabled = true 48 | script { 49 | embed = true 50 | } 51 | } 52 | json { enabled = true } 53 | mermaid { enabled = true } 54 | } 55 | } 56 | 57 | checkReports { 58 | jsonReport = 'build/reports/tests-execution/json/integrationTest.json' 59 | htmlReport = 'build/reports/tests-execution/html/integrationTest.html' 60 | mermaidReport = 'build/reports/tests-execution/mermaid/integrationTest.txt' 61 | } 62 | -------------------------------------------------------------------------------- /test-projects/spock-multiple-test-tasks/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/platan/tests-execution-chart/a76059793ac9f0f7721f4c3d7543efd16449135a/test-projects/spock-multiple-test-tasks/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /test-projects/spock-multiple-test-tasks/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /test-projects/spock-multiple-test-tasks/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /test-projects/spock-multiple-test-tasks/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'spock-multiple-test-tasks' 2 | 3 | includeBuild('../..') 4 | -------------------------------------------------------------------------------- /test-projects/spock-multiple-test-tasks/src/intTest/groovy/Test1Spec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Ignore 2 | import spock.lang.Specification 3 | 4 | 5 | class Test1Spec extends Specification { 6 | 7 | private static final int sleepDuration = 200 8 | 9 | def "test 1"() { 10 | sleep sleepDuration 11 | expect: 12 | true 13 | } 14 | 15 | @Ignore 16 | def "test 2"() { 17 | sleep sleepDuration 18 | expect: 19 | false 20 | } 21 | 22 | def "test 3"() { 23 | sleep sleepDuration 24 | expect: 25 | true 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /test-projects/spock-multiple-test-tasks/src/intTest/groovy/Test2Spec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Ignore 2 | import spock.lang.Specification 3 | import spock.lang.Unroll 4 | 5 | 6 | class Test2Spec extends Specification { 7 | 8 | private static final int sleepDuration = 500 9 | 10 | def "test 1"() { 11 | sleep sleepDuration 12 | expect: 13 | true 14 | } 15 | 16 | @Ignore 17 | def "test 2"() { 18 | sleep sleepDuration 19 | expect: 20 | true 21 | 22 | } 23 | 24 | @Unroll 25 | def "test 3 x=#x"() { 26 | sleep sleepDuration 27 | expect: 28 | true 29 | where: 30 | x << ['a', 'b'] 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /test-projects/spock-multiple-test-tasks/src/intTest/groovy/TestIsolatedSpec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Isolated 2 | import spock.lang.Specification 3 | 4 | @Isolated 5 | class TestIsolatedSpec extends Specification { 6 | 7 | private static final int sleepDuration = 50 8 | 9 | def "test 1"() { 10 | sleep sleepDuration 11 | expect: 12 | true 13 | } 14 | 15 | def "test 2"() { 16 | sleep sleepDuration 17 | expect: 18 | true 19 | } 20 | 21 | def "test 3"() { 22 | sleep sleepDuration 23 | expect: 24 | true 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /test-projects/spock-multiple-test-tasks/src/intTest/resources/SpockConfig.groovy: -------------------------------------------------------------------------------- 1 | runner { 2 | parallel { 3 | enabled true 4 | } 5 | } -------------------------------------------------------------------------------- /test-projects/spock-single-module/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | **/build/ 3 | !src/**/build/ 4 | 5 | # Ignore Gradle GUI config 6 | gradle-app.setting 7 | 8 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 9 | !gradle-wrapper.jar 10 | 11 | # Avoid ignore Gradle wrappper properties 12 | !gradle-wrapper.properties 13 | 14 | # Cache of project 15 | .gradletasknamecache 16 | 17 | # Eclipse Gradle plugin generated files 18 | # Eclipse Core 19 | .project 20 | # JDT-specific (Eclipse Java Development Tools) 21 | .classpath -------------------------------------------------------------------------------- /test-projects/spock-single-module/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'groovy' 3 | id 'java' 4 | id 'io.github.platan.tests-execution-chart' 5 | } 6 | 7 | apply from: '../checks.gradle' 8 | 9 | repositories { 10 | mavenCentral() 11 | } 12 | 13 | dependencies { 14 | testImplementation 'org.codehaus.groovy:groovy-all:3.0.10' 15 | testImplementation platform("org.spockframework:spock-bom:2.1-groovy-3.0") 16 | testImplementation "org.spockframework:spock-core" 17 | } 18 | 19 | test { 20 | useJUnitPlatform() 21 | } 22 | 23 | createTestsExecutionReport { 24 | formats { 25 | html { 26 | enabled = true 27 | script { 28 | config { 29 | maxTextSize = 2000 30 | } 31 | } 32 | } 33 | json { enabled = true } 34 | mermaid { enabled = true } 35 | } 36 | marks { 37 | totalTimeOfAllTests { 38 | enabled = true 39 | name = 'total time of all tests' 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test-projects/spock-single-module/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/platan/tests-execution-chart/a76059793ac9f0f7721f4c3d7543efd16449135a/test-projects/spock-single-module/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /test-projects/spock-single-module/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /test-projects/spock-single-module/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit 88 | 89 | # Use the maximum available, or set MAX_FD != -1 to use that value. 90 | MAX_FD=maximum 91 | 92 | warn () { 93 | echo "$*" 94 | } >&2 95 | 96 | die () { 97 | echo 98 | echo "$*" 99 | echo 100 | exit 1 101 | } >&2 102 | 103 | # OS specific support (must be 'true' or 'false'). 104 | cygwin=false 105 | msys=false 106 | darwin=false 107 | nonstop=false 108 | case "$( uname )" in #( 109 | CYGWIN* ) cygwin=true ;; #( 110 | Darwin* ) darwin=true ;; #( 111 | MSYS* | MINGW* ) msys=true ;; #( 112 | NONSTOP* ) nonstop=true ;; 113 | esac 114 | 115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 116 | 117 | 118 | # Determine the Java command to use to start the JVM. 119 | if [ -n "$JAVA_HOME" ] ; then 120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 121 | # IBM's JDK on AIX uses strange locations for the executables 122 | JAVACMD=$JAVA_HOME/jre/sh/java 123 | else 124 | JAVACMD=$JAVA_HOME/bin/java 125 | fi 126 | if [ ! -x "$JAVACMD" ] ; then 127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 128 | 129 | Please set the JAVA_HOME variable in your environment to match the 130 | location of your Java installation." 131 | fi 132 | else 133 | JAVACMD=java 134 | if ! command -v java >/dev/null 2>&1 135 | then 136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | fi 142 | 143 | # Increase the maximum file descriptors if we can. 144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 145 | case $MAX_FD in #( 146 | max*) 147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 148 | # shellcheck disable=SC2039,SC3045 149 | MAX_FD=$( ulimit -H -n ) || 150 | warn "Could not query maximum file descriptor limit" 151 | esac 152 | case $MAX_FD in #( 153 | '' | soft) :;; #( 154 | *) 155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 156 | # shellcheck disable=SC2039,SC3045 157 | ulimit -n "$MAX_FD" || 158 | warn "Could not set maximum file descriptor limit to $MAX_FD" 159 | esac 160 | fi 161 | 162 | # Collect all arguments for the java command, stacking in reverse order: 163 | # * args from the command line 164 | # * the main class name 165 | # * -classpath 166 | # * -D...appname settings 167 | # * --module-path (only if needed) 168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 169 | 170 | # For Cygwin or MSYS, switch paths to Windows format before running java 171 | if "$cygwin" || "$msys" ; then 172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 174 | 175 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 176 | 177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 178 | for arg do 179 | if 180 | case $arg in #( 181 | -*) false ;; # don't mess with options #( 182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 183 | [ -e "$t" ] ;; #( 184 | *) false ;; 185 | esac 186 | then 187 | arg=$( cygpath --path --ignore --mixed "$arg" ) 188 | fi 189 | # Roll the args list around exactly as many times as the number of 190 | # args, so each arg winds up back in the position where it started, but 191 | # possibly modified. 192 | # 193 | # NB: a `for` loop captures its iteration list before it begins, so 194 | # changing the positional parameters here affects neither the number of 195 | # iterations, nor the values presented in `arg`. 196 | shift # remove old arg 197 | set -- "$@" "$arg" # push replacement arg 198 | done 199 | fi 200 | 201 | 202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 204 | 205 | # Collect all arguments for the java command: 206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 207 | # and any embedded shellness will be escaped. 208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 209 | # treated as '${Hostname}' itself on the command line. 210 | 211 | set -- \ 212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 213 | -classpath "$CLASSPATH" \ 214 | org.gradle.wrapper.GradleWrapperMain \ 215 | "$@" 216 | 217 | # Stop when "xargs" is not available. 218 | if ! command -v xargs >/dev/null 2>&1 219 | then 220 | die "xargs is not available" 221 | fi 222 | 223 | # Use "xargs" to parse quoted args. 224 | # 225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 226 | # 227 | # In Bash we could simply go: 228 | # 229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 230 | # set -- "${ARGS[@]}" "$@" 231 | # 232 | # but POSIX shell has neither arrays nor command substitution, so instead we 233 | # post-process each arg (as a line of input to sed) to backslash-escape any 234 | # character that might be a shell metacharacter, then use eval to reverse 235 | # that process (while maintaining the separation between arguments), and wrap 236 | # the whole thing up as a single "set" statement. 237 | # 238 | # This will of course break if any of these variables contains a newline or 239 | # an unmatched quote. 240 | # 241 | 242 | eval "set -- $( 243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 244 | xargs -n1 | 245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 246 | tr '\n' ' ' 247 | )" '"$@"' 248 | 249 | exec "$JAVACMD" "$@" 250 | -------------------------------------------------------------------------------- /test-projects/spock-single-module/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /test-projects/spock-single-module/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'spock-single-module' 2 | 3 | includeBuild('../..') 4 | -------------------------------------------------------------------------------- /test-projects/spock-single-module/src/test/groovy/Test1Spec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Ignore 2 | import spock.lang.Specification 3 | 4 | 5 | class Test1Spec extends Specification { 6 | 7 | private static final int sleepDuration = 200 8 | 9 | def "test 1"() { 10 | sleep sleepDuration 11 | expect: 12 | true 13 | } 14 | 15 | @Ignore 16 | def "test 2"() { 17 | sleep sleepDuration 18 | expect: 19 | false 20 | } 21 | 22 | def "test 3"() { 23 | sleep sleepDuration 24 | expect: 25 | true 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /test-projects/spock-single-module/src/test/groovy/Test2Spec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Ignore 2 | import spock.lang.Specification 3 | import spock.lang.Unroll 4 | 5 | 6 | class Test2Spec extends Specification { 7 | 8 | private static final int sleepDuration = 300 9 | 10 | def "test 1"() { 11 | sleep sleepDuration 12 | expect: 13 | true 14 | } 15 | 16 | @Ignore 17 | def "test 2"() { 18 | sleep sleepDuration 19 | expect: 20 | true 21 | 22 | } 23 | 24 | @Unroll 25 | def "test 3 x=#x"() { 26 | sleep sleepDuration 27 | expect: 28 | true 29 | where: 30 | x << ['a', 'b'] 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /test-projects/spock-single-module/src/test/groovy/TestIsolatedSpec.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.Isolated 2 | import spock.lang.Specification 3 | 4 | @Isolated 5 | class TestIsolatedSpec extends Specification { 6 | 7 | private static final int sleepDuration = 100 8 | 9 | def "test 1"() { 10 | sleep sleepDuration 11 | expect: 12 | true 13 | } 14 | 15 | def "test 2"() { 16 | sleep sleepDuration 17 | expect: 18 | true 19 | } 20 | 21 | def "test 3"() { 22 | sleep sleepDuration 23 | expect: 24 | true 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /test-projects/spock-single-module/src/test/resources/SpockConfig.groovy: -------------------------------------------------------------------------------- 1 | runner { 2 | parallel { 3 | enabled true 4 | } 5 | } -------------------------------------------------------------------------------- /test-projects/testNG-single-module/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | -------------------------------------------------------------------------------- /test-projects/testNG-single-module/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'io.github.platan.tests-execution-chart' 4 | } 5 | 6 | apply from: '../checks.gradle' 7 | 8 | repositories { 9 | mavenCentral() 10 | } 11 | 12 | test { 13 | useTestNG() { 14 | suites 'src/test/resources/testng-parallel.xml', 'src/test/resources/testng-isolated.xml' 15 | } 16 | } 17 | 18 | dependencies { 19 | testImplementation 'org.testng:testng:7.6.1' 20 | } 21 | -------------------------------------------------------------------------------- /test-projects/testNG-single-module/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/platan/tests-execution-chart/a76059793ac9f0f7721f4c3d7543efd16449135a/test-projects/testNG-single-module/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /test-projects/testNG-single-module/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /test-projects/testNG-single-module/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /test-projects/testNG-single-module/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'testNG-single-module' 2 | 3 | includeBuild('../..') 4 | -------------------------------------------------------------------------------- /test-projects/testNG-single-module/src/test/java/Test1.java: -------------------------------------------------------------------------------- 1 | import org.testng.annotations.Ignore; 2 | import org.testng.annotations.Test; 3 | 4 | import static org.testng.AssertJUnit.assertTrue; 5 | 6 | @Test(groups = {"parallel"}) 7 | public class Test1 { 8 | 9 | private static final int sleepDurationMs = 200; 10 | 11 | @Test 12 | public void test1() throws InterruptedException { 13 | Thread.sleep(sleepDurationMs); 14 | assertTrue(true); 15 | } 16 | 17 | @Ignore 18 | @Test 19 | public void test2() throws InterruptedException { 20 | Thread.sleep(sleepDurationMs); 21 | assertTrue(true); 22 | } 23 | 24 | @Test 25 | public void test3() throws InterruptedException { 26 | Thread.sleep(sleepDurationMs); 27 | assertTrue(true); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test-projects/testNG-single-module/src/test/java/Test2.java: -------------------------------------------------------------------------------- 1 | import org.testng.annotations.DataProvider; 2 | import org.testng.annotations.Ignore; 3 | import org.testng.annotations.Test; 4 | 5 | import static org.testng.AssertJUnit.assertTrue; 6 | 7 | @Test(groups = {"parallel"}) 8 | public class Test2 { 9 | 10 | private static final int sleepDurationMs = 300; 11 | 12 | @DataProvider(name = "data-provider", parallel = true) 13 | public static Object[][] createData() { 14 | return new Object[][]{{1}, {2}}; 15 | } 16 | 17 | 18 | @Test 19 | public void test1() throws InterruptedException { 20 | Thread.sleep(sleepDurationMs); 21 | assertTrue(true); 22 | } 23 | 24 | @Ignore 25 | @Test 26 | public void test2() throws InterruptedException { 27 | Thread.sleep(sleepDurationMs); 28 | assertTrue(true); 29 | } 30 | 31 | @Test(dataProvider = "data-provider") 32 | public void test3(int x) throws InterruptedException { 33 | Thread.sleep(sleepDurationMs); 34 | assertTrue(true); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test-projects/testNG-single-module/src/test/java/TestIsolated.java: -------------------------------------------------------------------------------- 1 | import org.testng.annotations.Test; 2 | 3 | import static org.testng.AssertJUnit.assertTrue; 4 | 5 | @Test(groups = {"isolated"}) 6 | public class TestIsolated { 7 | 8 | private static final int sleepDurationMs = 100; 9 | 10 | public void test1() throws InterruptedException { 11 | Thread.sleep(sleepDurationMs); 12 | assertTrue(true); 13 | } 14 | 15 | public void test2() throws InterruptedException { 16 | Thread.sleep(sleepDurationMs); 17 | assertTrue(true); 18 | } 19 | 20 | public void test3() throws InterruptedException { 21 | Thread.sleep(sleepDurationMs); 22 | assertTrue(true); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test-projects/testNG-single-module/src/test/resources/testng-isolated.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test-projects/testNG-single-module/src/test/resources/testng-parallel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("org.jetbrains.kotlin.jvm") version "2.1.0" 3 | kotlin("plugin.serialization") version "2.1.0" 4 | `maven-publish` 5 | id("org.jetbrains.kotlinx.kover") version "0.9.0" 6 | signing 7 | id("io.github.platan.tests-execution-chart") 8 | } 9 | 10 | dependencies { 11 | api("org.jetbrains.kotlin:kotlin-stdlib") 12 | implementation("org.apache.commons:commons-text:1.13.0") 13 | implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0") 14 | 15 | testImplementation(platform("org.codehaus.groovy:groovy-bom:3.0.22")) 16 | testImplementation("org.codehaus.groovy:groovy") 17 | testImplementation(platform("org.spockframework:spock-bom:2.4-M2-groovy-3.0")) 18 | testImplementation("org.spockframework:spock-core") 19 | } 20 | 21 | java { 22 | withSourcesJar() 23 | withJavadocJar() 24 | } 25 | 26 | publishing { 27 | publications { 28 | create("mavenJava") { 29 | from(components["java"]) 30 | 31 | pom { 32 | name.set("$groupId:$artifactId") 33 | description.set("Visualise tests execution schedule") 34 | url.set("https://github.com/platan/tests-execution-chart") 35 | licenses { 36 | license { 37 | name.set("MIT License") 38 | url.set("https://github.com/platan/tests-execution-chart/blob/main/LICENSE") 39 | } 40 | } 41 | developers { 42 | developer { 43 | id.set("platan") 44 | name.set("Marcin Mielnicki") 45 | email.set("projects@platan.space") 46 | } 47 | } 48 | scm { 49 | connection.set("scm:git:git://github.com/platan/tests-execution-chart.git") 50 | developerConnection.set("scm:git:ssh://github.com:platan/tests-execution-chart.git") 51 | url.set("https://github.com/platan/tests-execution-chart/tree/main") 52 | } 53 | } 54 | } 55 | } 56 | } 57 | 58 | tasks.test { 59 | finalizedBy(tasks.koverHtmlReport, tasks.koverXmlReport) 60 | } 61 | 62 | tasks.koverXmlReport { 63 | dependsOn(tasks.test) 64 | } 65 | tasks.koverHtmlReport { 66 | dependsOn(tasks.test) 67 | } 68 | 69 | extra["isReleaseVersion"] = !version.toString().endsWith("SNAPSHOT") 70 | 71 | signing { 72 | setRequired({ 73 | (project.extra["isReleaseVersion"] as Boolean) && gradle.taskGraph.hasTask("publishToSonatype") 74 | }) 75 | sign(publishing.publications["mavenJava"]) 76 | } 77 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/report/ReportConfig.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.report 2 | 3 | data class ReportConfig( 4 | val formatsList: List, 5 | val marks: Marks, 6 | val shiftTimestampsToStartOfDay: Boolean = false, 7 | ) { 8 | data class Marks(val totalTimeOfAllTests: Mark = DISABLED) { 9 | data class Mark(val enabled: Boolean, val name: String) 10 | companion object { 11 | val DISABLED: Mark = Mark(false, "") 12 | } 13 | } 14 | 15 | interface Format { 16 | val enabled: Boolean 17 | val outputLocation: String 18 | } 19 | } -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/report/ReportConfigurator.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.report 2 | 3 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 4 | import java.time.ZoneId 5 | 6 | class ReportConfigurator { 7 | fun configure(results: TestExecutionScheduleReport, config: ReportConfig): TestExecutionScheduleReport { 8 | var adjusted = results 9 | if (config.shiftTimestampsToStartOfDay) { 10 | adjusted = results.timestampsShiftedToStartOfDay(ZoneId.systemDefault()) 11 | } 12 | if (config.marks.totalTimeOfAllTests.enabled) { 13 | adjusted = adjusted.addTotalTimeOfAllTestsMark(config.marks.totalTimeOfAllTests.name) 14 | } 15 | return adjusted 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/report/ReportCreator.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.report 2 | 3 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 4 | import io.github.platan.tests_execution_chart.reporters.GanttDiagramReporter 5 | import io.github.platan.tests_execution_chart.reporters.Logger 6 | import java.io.File 7 | import java.util.* 8 | 9 | 10 | class ReportCreator(private val logger: Logger, private val availableReporters: Iterable>) { 11 | 12 | constructor(logger: Logger) : this(logger, ServiceLoader.load(GanttDiagramReporter::class.java)) 13 | 14 | fun createReports( 15 | results: TestExecutionScheduleReport, 16 | reportConfig: ReportConfig, 17 | buildDir: File, 18 | taskName: String 19 | ) { 20 | val adjustedResults = ReportConfigurator().configure(results, reportConfig) 21 | logger.lifecycle("Tests execution schedule report for task '$taskName'") 22 | val configsByType = reportConfig.formatsList.associateBy { it.javaClass } 23 | val enabledReporters = availableReporters.filter { reporter -> 24 | val config = configsByType[reporter.getConfigType()] 25 | if (config == null) { 26 | false 27 | } else { 28 | reporter.setConfiguration(config) 29 | reporter.logger = logger 30 | // TODO ask reporter if it's enabled 31 | config.enabled 32 | } 33 | } 34 | enabledReporters.forEach { reporter -> 35 | reporter.report(adjustedResults, buildDir, taskName) 36 | } 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/report/TestExecutionScheduleReportBuilder.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.report 2 | 3 | import io.github.platan.tests_execution_chart.report.data.Mark 4 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 5 | import io.github.platan.tests_execution_chart.report.data.TimedTestResult 6 | 7 | class TestExecutionScheduleReportBuilder { 8 | private var results = mutableListOf() 9 | private var marks = mutableListOf() 10 | fun addResult( 11 | className: String?, 12 | testName: String, 13 | startTime: Long, 14 | endTime: Long, 15 | resultType: String, 16 | type: TimedTestResult.Type 17 | ): TestExecutionScheduleReportBuilder { 18 | results.add(TimedTestResult(className, testName, startTime, endTime, resultType, type)) 19 | return this 20 | } 21 | 22 | fun addMark(name: String, timestamp: Long): TestExecutionScheduleReportBuilder { 23 | marks.add(Mark(name, timestamp)) 24 | return this 25 | } 26 | 27 | fun build(): TestExecutionScheduleReport { 28 | return TestExecutionScheduleReport(results, marks) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/report/data/Mark.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.report.data 2 | 3 | import kotlinx.serialization.Serializable 4 | import java.time.Duration 5 | 6 | @Serializable 7 | data class Mark( 8 | var name: String, 9 | var timestamp: Long 10 | ) { 11 | fun shiftTimestamps(timeShift: Duration): Mark { 12 | return this.copy(timestamp = this.timestamp + timeShift.toMillis()) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/report/data/TestExecutionScheduleReport.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.report.data 2 | 3 | import kotlinx.serialization.Serializable 4 | import java.time.Duration 5 | import java.time.Instant 6 | import java.time.ZoneId 7 | import java.time.temporal.ChronoUnit 8 | 9 | @Serializable 10 | data class TestExecutionScheduleReport(val results: List, val marks: List) { 11 | 12 | constructor(results: List) : this(results, emptyList()) 13 | 14 | fun timestampsShiftedToStartOfDay(zoneId: ZoneId): TestExecutionScheduleReport { 15 | return when { 16 | results.isEmpty() -> this 17 | else -> { 18 | val minStartTime = Instant.ofEpochMilli(results.minBy { it.startTime }.startTime) 19 | val targetMinStartTime = minStartTime.atZone(zoneId).truncatedTo(ChronoUnit.DAYS).toInstant() 20 | val timeShift = Duration.between(minStartTime, targetMinStartTime) 21 | return TestExecutionScheduleReport( 22 | results.map { it.shiftTimestamps(timeShift) }, 23 | marks.map { it.shiftTimestamps(timeShift) } 24 | ) 25 | } 26 | } 27 | } 28 | 29 | fun addTotalTimeOfAllTestsMark(markName: String): TestExecutionScheduleReport { 30 | val minStartTime = results.minBy { it.startTime }.startTime 31 | val totalDurationOfAllTestsMs = results.sumOf { it.durationMs } 32 | val totalTimeOfAllTestsMark = minStartTime + totalDurationOfAllTestsMs 33 | return this.copy(marks = listOf(Mark(markName, totalTimeOfAllTestsMark))) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/report/data/TimedTestResult.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.report.data 2 | 3 | import kotlinx.serialization.Serializable 4 | import java.time.Duration 5 | 6 | @Serializable 7 | data class TimedTestResult( 8 | // TODO deprecate, rename to groupName 9 | val className: String?, 10 | val testName: String, 11 | val startTime: Long, 12 | val endTime: Long, 13 | // TODO deprecate, rename to result 14 | val resultType: String, 15 | val type: Type 16 | ) { 17 | 18 | fun shiftTimestamps(timeShift: Duration): TimedTestResult { 19 | return this.copy( 20 | startTime = this.startTime + timeShift.toMillis(), 21 | endTime = this.endTime + timeShift.toMillis() 22 | ) 23 | } 24 | 25 | val durationMs: Long 26 | get() = this.endTime - this.startTime 27 | 28 | enum class Type { 29 | SUITE, TEST 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/GanttDiagramReporter.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters 2 | 3 | import io.github.platan.tests_execution_chart.report.ReportConfig 4 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 5 | import java.io.File 6 | 7 | abstract class GanttDiagramReporter { 8 | 9 | protected lateinit var config: T 10 | var logger: Logger = NoopLogger 11 | 12 | fun setConfiguration(configuration: ReportConfig.Format) { 13 | @Suppress("UNCHECKED_CAST") 14 | this.config = configuration as T 15 | } 16 | 17 | abstract fun report(report: TestExecutionScheduleReport, baseDir: File, taskName: String) 18 | 19 | abstract fun getConfigType(): Class 20 | } 21 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/Logger.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters 2 | 3 | interface Logger { 4 | fun lifecycle(message: String) 5 | } 6 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/NoopLogger.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters 2 | 3 | object NoopLogger : Logger { 4 | override fun lifecycle(message: String) { 5 | // nothing to do 6 | } 7 | 8 | } 9 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/SingleFileReportWriter.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters 2 | 3 | import java.io.File 4 | 5 | class SingleFileReportWriter { 6 | 7 | fun save( 8 | report: String, 9 | taskName: String, 10 | baseDir: File, 11 | location: String, 12 | extension: String 13 | ): File { 14 | val reportsDir = prepareReportsDir(baseDir, location) 15 | val reportFile = File(reportsDir, "$taskName.$extension") 16 | reportFile.writeText(report) 17 | return reportFile 18 | } 19 | 20 | private fun prepareReportsDir(baseDir: File, location: String): File { 21 | val reportsDir = File(baseDir, location) 22 | reportsDir.mkdirs() 23 | return reportsDir 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/TestExecutionReportFormatter.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters 2 | 3 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 4 | 5 | interface TestExecutionReportFormatter { 6 | fun format(report: TestExecutionScheduleReport): String 7 | } 8 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/html/HtmlConfig.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.html 2 | 3 | import io.github.platan.tests_execution_chart.report.ReportConfig 4 | 5 | data class HtmlConfig(override val enabled: Boolean, override val outputLocation: String, val script: Script) : 6 | ReportConfig.Format { 7 | data class Script(val src: String, val embed: Boolean, val options: Options) { 8 | 9 | companion object { 10 | private const val DEFAULT_MERMAID_SCRIPT_SRC = 11 | "https://cdn.jsdelivr.net/npm/mermaid@11.3.0/dist/mermaid.min.js" 12 | 13 | @JvmStatic 14 | fun getSrcDefault(): String = DEFAULT_MERMAID_SCRIPT_SRC 15 | } 16 | 17 | data class Options(val maxTextSize: Int) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/html/HtmlGanttDiagramFormatter.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.html 2 | 3 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 4 | import io.github.platan.tests_execution_chart.reporters.mermaid.TestExecutionMermaidDiagramFormatter 5 | import java.net.URL 6 | 7 | private const val TEMPLATE_HTML_FILE = "template.html" 8 | private const val GRAPH_PLACEHOLDER = "@GRAPH_PLACEHOLDER@" 9 | private const val MAX_TEXT_SIZE_PLACEHOLDER = "@MAX_TEXT_SIZE@" 10 | private const val MERMAID_SRC_PLACEHOLDER = "@MERMAID_SRC@" 11 | private const val TABLE_SRC_PLACEHOLDER = "@TABLE@" 12 | 13 | class HtmlGanttDiagramFormatter { 14 | 15 | fun format( 16 | report: TestExecutionScheduleReport, 17 | scriptSrc: String, 18 | maxTextSize: Int 19 | ): String { 20 | val template: String = loadTemplate(TEMPLATE_HTML_FILE) 21 | return prepareHtmlReport(report, template, scriptSrc, maxTextSize) 22 | } 23 | 24 | private fun loadTemplate(templatePath: String): String { 25 | val resource: URL? = this::class.java.classLoader.getResource(templatePath) 26 | val template: String 27 | if (resource == null) { 28 | throw RuntimeException("$templatePath not found") 29 | } else { 30 | template = resource.readText(Charsets.UTF_8) 31 | } 32 | return template 33 | } 34 | 35 | 36 | private fun prepareHtmlReport( 37 | report: TestExecutionScheduleReport, 38 | template: String, 39 | src: String, 40 | maxTextSize: Int 41 | ): String { 42 | val mermaid = TestExecutionMermaidDiagramFormatter().format(report) 43 | val escapedMermaid = mermaid 44 | .replace("\\", "\\\\") 45 | // Mermaid data is put in javascript code and specified using backtick character (`). 46 | // We have to escape ` character. 47 | .replace("`", "\\`") 48 | val table = HtmlTableFormatter().format(report) 49 | return template 50 | .replace(GRAPH_PLACEHOLDER, escapedMermaid) 51 | .replace(MERMAID_SRC_PLACEHOLDER, src) 52 | .replace(MAX_TEXT_SIZE_PLACEHOLDER, maxTextSize.toString()) 53 | .replace(TABLE_SRC_PLACEHOLDER, table) 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/html/HtmlGanttDiagramReporter.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.html 2 | 3 | import io.github.platan.tests_execution_chart.report.ReportConfig 4 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 5 | import io.github.platan.tests_execution_chart.reporters.GanttDiagramReporter 6 | import io.github.platan.tests_execution_chart.reporters.SingleFileReportWriter 7 | import java.io.File 8 | import java.net.URL 9 | import java.nio.file.Files 10 | import java.nio.file.Paths 11 | 12 | const val MERMAID_JS_FILE_NAME = "mermaid.min.js" 13 | 14 | 15 | class HtmlGanttDiagramReporter : 16 | GanttDiagramReporter() { 17 | 18 | 19 | override fun report(report: TestExecutionScheduleReport, baseDir: File, taskName: String) { 20 | var scriptSrc = config.script.src 21 | if (config.script.embed) { 22 | val reportsDir = prepareReportsDir(baseDir, config.outputLocation) 23 | val scriptFileName = MERMAID_JS_FILE_NAME 24 | downloadFile(URL(scriptSrc), "${reportsDir.absolutePath}/$scriptFileName") 25 | scriptSrc = scriptFileName 26 | } 27 | val maxTextSize = config.script.options.maxTextSize 28 | 29 | val htmlReport = HtmlGanttDiagramFormatter().format(report, scriptSrc, maxTextSize) 30 | val reportFile = SingleFileReportWriter().save(htmlReport, taskName, baseDir, config.outputLocation, "html") 31 | logger.lifecycle("Tests execution schedule report saved to ${reportFile.absolutePath} file.") 32 | } 33 | 34 | override fun getConfigType(): Class = HtmlConfig::class.java 35 | 36 | private fun prepareReportsDir(baseDir: File, location: String): File { 37 | val reportsDir = File(baseDir, location) 38 | reportsDir.mkdirs() 39 | return reportsDir 40 | } 41 | 42 | 43 | private fun downloadFile(url: URL, path: String) { 44 | url.openStream().use { Files.copy(it, Paths.get(path)) } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/html/HtmlTableFormatter.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.html 2 | 3 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 4 | import org.apache.commons.text.StringEscapeUtils.escapeHtml4 5 | 6 | class HtmlTableFormatter { 7 | 8 | fun format(report: TestExecutionScheduleReport): String { 9 | val tbody = StringBuilder() 10 | report.results.sortedByDescending { it.durationMs }.map { 11 | tbody.append( 12 | """${escapeHtml4(it.testName)} 13 | ${it.className} 14 | ${it.resultType} 15 | ${it.durationMs}""" 16 | ) 17 | } 18 | return """ 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | $tbody 29 | 30 |
Test nameClass nameResultDuration (ms)
""" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/json/JsonConfig.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.json 2 | 3 | import io.github.platan.tests_execution_chart.report.ReportConfig 4 | 5 | data class JsonConfig(override val enabled: Boolean, override val outputLocation: String) : ReportConfig.Format 6 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/json/JsonReporter.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.json 2 | 3 | import io.github.platan.tests_execution_chart.report.ReportConfig 4 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 5 | import io.github.platan.tests_execution_chart.reporters.GanttDiagramReporter 6 | import io.github.platan.tests_execution_chart.reporters.SingleFileReportWriter 7 | import java.io.File 8 | 9 | class JsonReporter : GanttDiagramReporter() { 10 | 11 | override fun report( 12 | report: TestExecutionScheduleReport, 13 | baseDir: File, 14 | taskName: String 15 | ) { 16 | val jsonReport = JsonTestExecutionReportFormatter().format(report) 17 | val reportFile = SingleFileReportWriter().save(jsonReport, taskName, baseDir, config.outputLocation, "json") 18 | logger.lifecycle("Tests execution schedule report saved to ${reportFile.absolutePath} file.") 19 | } 20 | 21 | override fun getConfigType(): Class = JsonConfig::class.java 22 | } 23 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/json/JsonTestExecutionReportFormatter.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.json 2 | 3 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 4 | import io.github.platan.tests_execution_chart.reporters.TestExecutionReportFormatter 5 | import kotlinx.serialization.encodeToString 6 | import kotlinx.serialization.json.Json 7 | 8 | class JsonTestExecutionReportFormatter : TestExecutionReportFormatter { 9 | private val json = Json { 10 | prettyPrint = true 11 | } 12 | 13 | override fun format(report: TestExecutionScheduleReport): String { 14 | return json.encodeToString(report) 15 | } 16 | } -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/mermaid/MermaidConfig.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.mermaid 2 | 3 | import io.github.platan.tests_execution_chart.report.ReportConfig.Format 4 | 5 | data class MermaidConfig(override val enabled: Boolean, override val outputLocation: String) : Format 6 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/mermaid/MermaidTestsReporter.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.mermaid 2 | 3 | import io.github.platan.tests_execution_chart.report.ReportConfig 4 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 5 | import io.github.platan.tests_execution_chart.reporters.GanttDiagramReporter 6 | import io.github.platan.tests_execution_chart.reporters.SingleFileReportWriter 7 | import java.io.File 8 | 9 | class MermaidTestsReporter : 10 | GanttDiagramReporter() { 11 | 12 | 13 | override fun report(report: TestExecutionScheduleReport, baseDir: File, taskName: String) { 14 | val mermaidReport = TestExecutionMermaidDiagramFormatter().format(report) 15 | val reportFile = SingleFileReportWriter().save(mermaidReport, taskName, baseDir, config.outputLocation, "txt") 16 | logger.lifecycle("Tests execution schedule report saved to ${reportFile.absolutePath} file.") 17 | } 18 | 19 | override fun getConfigType(): Class = MermaidConfig::class.java 20 | } 21 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/mermaid/TestExecutionMermaidDiagramFormatter.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.mermaid 2 | 3 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 4 | import io.github.platan.tests_execution_chart.report.data.TimedTestResult 5 | import io.github.platan.tests_execution_chart.reporters.TestExecutionReportFormatter 6 | import io.github.platan.tests_execution_chart.reporters.mermaid.core.MermaidGanttDiagram 7 | import io.github.platan.tests_execution_chart.reporters.mermaid.core.MermaidGanttDiagramFormatter 8 | 9 | class TestExecutionMermaidDiagramFormatter : TestExecutionReportFormatter { 10 | 11 | companion object { 12 | val taskFormat: Map> = mapOf( 13 | TimedTestResult.Type.TEST to mapOf("FAILURE" to "crit", "SUCCESS" to "active"), 14 | TimedTestResult.Type.SUITE to mapOf("FAILURE" to "crit,done", "SUCCESS" to "done") 15 | ) 16 | } 17 | 18 | override fun format(report: TestExecutionScheduleReport): String { 19 | val diagramBuilder = MermaidGanttDiagram.MermaidGanttDiagramBuilder() 20 | report.results.groupBy { result -> result.className }.forEach { (className, results) -> 21 | diagramBuilder.addSection(className.orEmpty()) 22 | results.forEach { 23 | val testNameWithDuration = "${it.testName} - ${it.endTime.minus(it.startTime)} ms" 24 | diagramBuilder.addTask( 25 | testNameWithDuration, 26 | requireNotNull(taskFormat[it.type]) { "No mapping for `${it.type}`." }[it.resultType], 27 | it.startTime, 28 | it.endTime 29 | ) 30 | } 31 | } 32 | report.marks.forEach { mark -> 33 | diagramBuilder.addMilestone(mark.name, mark.timestamp) 34 | } 35 | val diagram = diagramBuilder.build("YYYY-MM-DDTHH:mm:ss.SSSZZ", "%H:%M:%S.%L") 36 | return MermaidGanttDiagramFormatter().format(diagram, "yyyy-MM-dd'T'HH:mm:ss.SSSZ") 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/mermaid/core/MermaidGanttDiagram.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.mermaid.core 2 | 3 | internal data class MermaidGanttDiagram( 4 | val dateFormat: String, 5 | val axisFormat: String, 6 | val entries: List 7 | ) { 8 | sealed interface Entry 9 | data class Section(val name: String) : Entry { 10 | init { 11 | require(name.isNotBlank()) { "Section name cannot be blank" } 12 | } 13 | } 14 | 15 | data class Task(val name: String, val type: String?, val start: Long, val end: Long) : Entry { 16 | init { 17 | require(name.isNotBlank()) { "Task name cannot be blank" } 18 | } 19 | } 20 | 21 | data class Milestone(val name: String, val timestamp: Long) : Entry { 22 | init { 23 | require(name.isNotBlank()) { "Mark name cannot be blank" } 24 | } 25 | } 26 | 27 | class MermaidGanttDiagramBuilder { 28 | private val entries: MutableList = mutableListOf() 29 | 30 | fun addTask(name: String, type: String?, start: Long, end: Long) { 31 | entries.add(Task(name, type, start, end)) 32 | } 33 | 34 | fun addSection(name: String) { 35 | entries.add(Section(name)) 36 | } 37 | 38 | fun addMilestone(name: String, timestamp: Long) { 39 | entries.add(Milestone(name, timestamp)) 40 | } 41 | 42 | fun build(dateFormat: String, axisFormat: String): MermaidGanttDiagram { 43 | return MermaidGanttDiagram( 44 | dateFormat, 45 | axisFormat, 46 | entries.toList() 47 | ) 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/kotlin/io/github/platan/tests_execution_chart/reporters/mermaid/core/MermaidGanttDiagramFormatter.kt: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.mermaid.core 2 | 3 | import java.time.Instant 4 | import java.time.ZoneId 5 | import java.time.format.DateTimeFormatter 6 | 7 | internal class MermaidGanttDiagramFormatter { 8 | 9 | fun format(diagram: MermaidGanttDiagram, dateFormat: String): String { 10 | val ganttDiagram = StringBuilder() 11 | ganttDiagram.append("gantt\n") 12 | ganttDiagram.append("dateFormat ${diagram.dateFormat}\n") 13 | ganttDiagram.append("axisFormat ${diagram.axisFormat}\n") 14 | val format = DateTimeFormatter.ofPattern(dateFormat).withZone(ZoneId.systemDefault()) 15 | diagram.entries.forEach { entry -> 16 | when (entry) { 17 | is MermaidGanttDiagram.Section -> { 18 | ganttDiagram.append("section ${escape(entry.name)}\n") 19 | } 20 | 21 | is MermaidGanttDiagram.Task -> { 22 | var status = "" 23 | if (entry.type != null) { 24 | status = "${entry.type}, " 25 | } 26 | val end = format.format(Instant.ofEpochMilli(entry.end)) 27 | val start = format.format(Instant.ofEpochMilli(entry.start)) 28 | ganttDiagram.append("${escape(entry.name)} :${status}$start, $end\n") 29 | } 30 | 31 | is MermaidGanttDiagram.Milestone -> { 32 | val timestamp = format.format(Instant.ofEpochMilli(entry.timestamp)) 33 | ganttDiagram.append("${escape(entry.name)} : milestone, $timestamp, 0\n") 34 | } 35 | } 36 | } 37 | return ganttDiagram.toString() 38 | } 39 | 40 | private fun escape(str: String): String { 41 | return str 42 | // warning: order of replacements below matters 43 | // replace ; before replacing other characters with entity containing ; 44 | .replace(";", "#semi;") 45 | // replace # but not in #semi; 46 | .replace(Regex("#(?!semi;)"), "#35;") 47 | .replace(":", "#colon;") // https://github.com/mermaid-js/mermaid/issues/742 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/resources/META-INF/services/io.github.platan.tests_execution_chart.reporters.GanttDiagramReporter: -------------------------------------------------------------------------------- 1 | io.github.platan.tests_execution_chart.reporters.mermaid.MermaidTestsReporter 2 | io.github.platan.tests_execution_chart.reporters.json.JsonReporter 3 | io.github.platan.tests_execution_chart.reporters.html.HtmlGanttDiagramReporter 4 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/main/resources/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Test execution chart 7 | 56 | 57 | 58 | 59 | 60 |
61 |
@TABLE@
62 | 78 | 79 | 86 | 87 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/test/groovy/io/github/platan/tests_execution_chart/report/ReportCreatorTest.groovy: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.report 2 | 3 | import io.github.platan.tests_execution_chart.reporters.Logger 4 | import io.github.platan.tests_execution_chart.reporters.json.JsonConfig 5 | import spock.lang.Specification 6 | import spock.lang.Subject 7 | import spock.lang.TempDir 8 | 9 | import java.time.Instant 10 | 11 | import static io.github.platan.tests_execution_chart.report.data.TimedTestResult.Type.TEST 12 | 13 | class ReportCreatorTest extends Specification { 14 | 15 | @TempDir 16 | File baseDir 17 | Logger logger = { String message -> println(message) } 18 | @Subject 19 | ReportCreator reportCreator = new ReportCreator(logger) 20 | def configOutputLocation = "my-output-location" 21 | 22 | def "should create report for given formats"() { 23 | given: 24 | def config = new ReportConfig([new JsonConfig(true, configOutputLocation)], new ReportConfig.Marks(), false) 25 | def report = new TestExecutionScheduleReportBuilder() 26 | .addResult('class', 'test', toEpochMilli('2023-03-10T19:00:02Z'), toEpochMilli('2023-03-10T19:00:05Z'), 'passed', TEST) 27 | .addMark('mark1', toEpochMilli('2023-03-10T19:00:05Z')).build() 28 | 29 | when: 30 | reportCreator.createReports(report, config, baseDir, 'my-task') 31 | 32 | then: 33 | def reportFile = new File(baseDir, "$configOutputLocation/my-task.json") 34 | reportFile.exists() 35 | } 36 | 37 | 38 | private static long toEpochMilli(String instant) { 39 | Instant.parse(instant).toEpochMilli() 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/test/groovy/io/github/platan/tests_execution_chart/report/TestExecutionScheduleReportMarksTest.groovy: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.report 2 | 3 | import io.github.platan.tests_execution_chart.report.data.Mark 4 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 5 | import io.github.platan.tests_execution_chart.report.data.TimedTestResult 6 | import spock.lang.Specification 7 | 8 | import java.time.Instant 9 | 10 | import static io.github.platan.tests_execution_chart.report.data.TimedTestResult.Type.TEST 11 | 12 | class TestExecutionScheduleReportMarksTest extends Specification { 13 | 14 | def "add mark with total time of all tests when report has many entries"() { 15 | given: 16 | def report = new TestExecutionScheduleReport([ 17 | new TimedTestResult('class', 'test', toEpochMilli('2023-03-10T19:00:02Z'), toEpochMilli('2023-03-10T19:00:06Z'), 'passed', TEST), 18 | new TimedTestResult('class', 'test', toEpochMilli('2023-03-10T19:00:03Z'), toEpochMilli('2023-03-10T19:00:07Z'), 'passed', TEST), 19 | ]) 20 | 21 | when: 22 | def resultWithMarks = report.addTotalTimeOfAllTestsMark('total time of all tests') 23 | 24 | then: 25 | resultWithMarks.results == report.results 26 | resultWithMarks.marks == [new Mark('total time of all tests', toEpochMilli('2023-03-10T19:00:10Z'))] 27 | } 28 | 29 | 30 | private static long toEpochMilli(String instant) { 31 | Instant.parse(instant).toEpochMilli() 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/test/groovy/io/github/platan/tests_execution_chart/report/TestExecutionScheduleReportTest.groovy: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.report 2 | 3 | import io.github.platan.tests_execution_chart.report.data.Mark 4 | import io.github.platan.tests_execution_chart.report.data.TestExecutionScheduleReport 5 | import io.github.platan.tests_execution_chart.report.data.TimedTestResult 6 | import spock.lang.Specification 7 | 8 | import java.time.Instant 9 | import java.time.ZoneOffset 10 | 11 | import static io.github.platan.tests_execution_chart.report.data.TimedTestResult.Type.TEST 12 | 13 | class TestExecutionScheduleReportTest extends Specification { 14 | 15 | def "shift timestamps when report has many entries"() { 16 | given: 17 | def report = new TestExecutionScheduleReport([ 18 | new TimedTestResult('class', 'test', toEpochMilli('2023-03-10T19:00:02Z'), toEpochMilli('2023-03-10T19:00:05Z'), 'passed', TEST), 19 | new TimedTestResult('class', 'test', toEpochMilli('2023-03-10T19:00:03Z'), toEpochMilli('2023-03-10T19:00:08Z'), 'passed', TEST), 20 | ], [new Mark('mark1', toEpochMilli('2023-03-10T19:00:05Z'))]) 21 | 22 | when: 23 | def shiftedResult = report.timestampsShiftedToStartOfDay(ZoneOffset.ofHours(0)) 24 | 25 | then: 26 | shiftedResult == new TestExecutionScheduleReport([ 27 | new TimedTestResult('class', 'test', toEpochMilli('2023-03-10T00:00:00Z'), toEpochMilli('2023-03-10T00:00:03Z'), 'passed', TEST), 28 | new TimedTestResult('class', 'test', toEpochMilli('2023-03-10T00:00:01Z'), toEpochMilli('2023-03-10T00:00:06Z'), 'passed', TEST), 29 | ], [new Mark('mark1', toEpochMilli('2023-03-10T00:00:03Z'))]) 30 | } 31 | 32 | def "shift timestamps when report has one entry"() { 33 | given: 34 | def report = new TestExecutionScheduleReport([ 35 | new TimedTestResult('class', 'test', toEpochMilli('2023-03-10T19:00:02Z'), toEpochMilli('2023-03-10T19:00:05Z'), 'passed', TEST), 36 | ]) 37 | 38 | when: 39 | def shiftedResult = report.timestampsShiftedToStartOfDay(ZoneOffset.ofHours(0)) 40 | 41 | then: 42 | shiftedResult == new TestExecutionScheduleReport([ 43 | new TimedTestResult('class', 'test', toEpochMilli('2023-03-10T00:00:00Z'), toEpochMilli('2023-03-10T00:00:03Z'), 'passed', TEST), 44 | ]) 45 | } 46 | 47 | def "shift timestamps when report has no entry"() { 48 | given: 49 | def report = new TestExecutionScheduleReport([]) 50 | 51 | when: 52 | def shiftedResult = report.timestampsShiftedToStartOfDay(ZoneOffset.ofHours(0)) 53 | 54 | then: 55 | shiftedResult == new TestExecutionScheduleReport([]) 56 | } 57 | 58 | private static long toEpochMilli(String instant) { 59 | Instant.parse(instant).toEpochMilli() 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/test/groovy/io/github/platan/tests_execution_chart/report/TimedTestResultTest.groovy: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.report 2 | 3 | import io.github.platan.tests_execution_chart.report.data.TimedTestResult 4 | import spock.lang.Specification 5 | 6 | import static io.github.platan.tests_execution_chart.report.data.TimedTestResult.Type.TEST 7 | import static java.time.Duration.ofMillis 8 | import static java.time.Duration.ofSeconds 9 | 10 | class TimedTestResultTest extends Specification { 11 | 12 | def "shift timestamps"() { 13 | given: 14 | def result = new TimedTestResult( 15 | 'class', 16 | 'test', 17 | givenStart, 18 | givenEnd, 19 | 'passed', 20 | TEST 21 | 22 | ) 23 | 24 | when: 25 | def shiftedResult = result.shiftTimestamps(timeShift) 26 | 27 | then: 28 | shiftedResult.className == 'class' 29 | shiftedResult.testName == 'test' 30 | shiftedResult.startTime == exectedStart 31 | shiftedResult.endTime == expectedEnd 32 | shiftedResult.resultType == 'passed' 33 | 34 | where: 35 | givenStart | givenEnd | timeShift || exectedStart | expectedEnd 36 | 1196712906001 | 1196712908001 | ofSeconds(-4) || 1196712902001 | 1196712904001 37 | 5000 | 6000 | ofSeconds(-4) || 1000 | 2000 38 | 2000 | 3000 | ofSeconds(-4) || -2000 | -1000 39 | 2000 | 3000 | ofSeconds(0) || 2000 | 3000 40 | 2000 | 3000 | ofSeconds(1) || 3000 | 4000 41 | 2000 | 3000 | ofMillis(-4) || 1996 | 2996 42 | 2000 | 3000 | ofMillis(0) || 2000 | 3000 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/test/groovy/io/github/platan/tests_execution_chart/reporters/html/HtmlGanttDiagramReporterTest.groovy: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.html 2 | 3 | import io.github.platan.tests_execution_chart.report.TestExecutionScheduleReportBuilder 4 | import spock.lang.Specification 5 | import spock.lang.Subject 6 | import spock.lang.TempDir 7 | 8 | class HtmlGanttDiagramReporterTest extends Specification { 9 | 10 | @Subject 11 | def htmlGanttDiagramReporter = new HtmlGanttDiagramReporter() 12 | def configOutputLocation = "my-output-location" 13 | 14 | def setup() { 15 | htmlGanttDiagramReporter.setLogger { println(it) } 16 | } 17 | 18 | @TempDir 19 | File baseDir 20 | 21 | def "should embed script file"() { 22 | given: 23 | def script = new HtmlConfig.Script(HtmlConfig.Script.getSrcDefault(), true, new HtmlConfig.Script.Options(10_000)) 24 | htmlGanttDiagramReporter.setConfiguration(new HtmlConfig(true, configOutputLocation, script)) 25 | def report = new TestExecutionScheduleReportBuilder().build() 26 | 27 | when: 28 | htmlGanttDiagramReporter.report(report, baseDir, 'my-task') 29 | 30 | then: 31 | def reportContent = new File(baseDir, "$configOutputLocation/my-task.html").text 32 | reportContent.contains '' 33 | new File(baseDir, "$configOutputLocation/mermaid.min.js").exists() 34 | } 35 | 36 | def "should not embed script file"() { 37 | given: 38 | def scriptSource = HtmlConfig.Script.getSrcDefault() 39 | def script = new HtmlConfig.Script(scriptSource, false, new HtmlConfig.Script.Options(10_000)) 40 | htmlGanttDiagramReporter.setConfiguration(new HtmlConfig(true, configOutputLocation, script)) 41 | def report = new TestExecutionScheduleReportBuilder().build() 42 | 43 | when: 44 | htmlGanttDiagramReporter.report(report, baseDir, 'my-task') 45 | 46 | then: 47 | def reportContent = new File(baseDir, "$configOutputLocation/my-task.html").text 48 | reportContent.contains """""" 49 | !new File(baseDir, "$configOutputLocation/mermaid.min.js").exists() 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/test/groovy/io/github/platan/tests_execution_chart/reporters/json/JsonReporterTest.groovy: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.json 2 | 3 | import io.github.platan.tests_execution_chart.report.TestExecutionScheduleReportBuilder 4 | import spock.lang.Specification 5 | import spock.lang.TempDir 6 | 7 | import java.time.Instant 8 | 9 | import static io.github.platan.tests_execution_chart.report.data.TimedTestResult.Type.TEST 10 | 11 | class JsonReporterTest extends Specification { 12 | 13 | @TempDir 14 | File baseDir 15 | 16 | def "should generate report in json"() { 17 | given: 18 | def configOutputLocation = "my-output-location" 19 | def report = new TestExecutionScheduleReportBuilder() 20 | .addResult('class', 'test', toEpochMilli('2023-03-10T19:00:02Z'), toEpochMilli('2023-03-10T19:00:05Z'), 'passed', TEST) 21 | .addMark('mark1', toEpochMilli('2023-03-10T19:00:05Z')).build() 22 | def reporter = new JsonReporter().tap { 23 | it.setConfiguration(new JsonConfig(true, configOutputLocation)) 24 | } 25 | 26 | when: 27 | reporter.report(report, baseDir, "taskname") 28 | 29 | then: 30 | def reportFile = new File(baseDir, "$configOutputLocation/taskname.json") 31 | reportFile.text == 32 | """{ 33 | | "results": [ 34 | | { 35 | | "className": "class", 36 | | "testName": "test", 37 | | "startTime": 1678474802000, 38 | | "endTime": 1678474805000, 39 | | "resultType": "passed", 40 | | "type": "TEST" 41 | | } 42 | | ], 43 | | "marks": [ 44 | | { 45 | | "name": "mark1", 46 | | "timestamp": 1678474805000 47 | | } 48 | | ] 49 | |}""".stripMargin() 50 | } 51 | 52 | private static long toEpochMilli(String instant) { 53 | Instant.parse(instant).toEpochMilli() 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/test/groovy/io/github/platan/tests_execution_chart/reporters/json/JsonTestExecutionReportFormatterTest.groovy: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.json 2 | 3 | import io.github.platan.tests_execution_chart.report.TestExecutionScheduleReportBuilder 4 | import spock.lang.Specification 5 | import spock.lang.Subject 6 | 7 | import java.time.Instant 8 | 9 | import static io.github.platan.tests_execution_chart.report.data.TimedTestResult.Type.TEST 10 | 11 | class JsonTestExecutionReportFormatterTest extends Specification { 12 | 13 | @Subject 14 | def formatter = new JsonTestExecutionReportFormatter() 15 | 16 | def "should format empty report"() { 17 | given: 18 | def emptyReport = new TestExecutionScheduleReportBuilder().build() 19 | 20 | when: 21 | def result = formatter.format(emptyReport) 22 | 23 | then: 24 | result == 25 | """{ 26 | | "results": [], 27 | | "marks": [] 28 | |}""".stripMargin() 29 | } 30 | 31 | def "should format report with one entry and one mark"() { 32 | given: 33 | def reportBuilder = new TestExecutionScheduleReportBuilder() 34 | .addResult('class', 'test', toEpochMilli('2023-03-10T19:00:02Z'), toEpochMilli('2023-03-10T19:00:05Z'), 'passed', TEST) 35 | .addMark('mark1', toEpochMilli('2023-03-10T19:00:05Z')) 36 | def report = reportBuilder.build() 37 | 38 | when: 39 | def result = formatter.format(report) 40 | 41 | then: 42 | result == 43 | """{ 44 | | "results": [ 45 | | { 46 | | "className": "class", 47 | | "testName": "test", 48 | | "startTime": 1678474802000, 49 | | "endTime": 1678474805000, 50 | | "resultType": "passed", 51 | | "type": "TEST" 52 | | } 53 | | ], 54 | | "marks": [ 55 | | { 56 | | "name": "mark1", 57 | | "timestamp": 1678474805000 58 | | } 59 | | ] 60 | |}""".stripMargin() 61 | } 62 | 63 | private static long toEpochMilli(String instant) { 64 | Instant.parse(instant).toEpochMilli() 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/test/groovy/io/github/platan/tests_execution_chart/reporters/mermaid/MermaidTestsReporterTest.groovy: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.mermaid 2 | 3 | import io.github.platan.tests_execution_chart.report.TestExecutionScheduleReportBuilder 4 | import spock.lang.Specification 5 | import spock.lang.Subject 6 | import spock.lang.TempDir 7 | 8 | import java.time.Instant 9 | import java.time.ZoneOffset 10 | 11 | import static io.github.platan.tests_execution_chart.report.data.TimedTestResult.Type.TEST 12 | 13 | class MermaidTestsReporterTest extends Specification { 14 | 15 | @TempDir 16 | File baseDir 17 | 18 | def configOutputLocation = "my-output-location" 19 | 20 | @Subject 21 | def reporter = new MermaidTestsReporter().tap { 22 | it.setConfiguration(new MermaidConfig(true, configOutputLocation)) 23 | } 24 | 25 | def "should generate report in mermaid format"() { 26 | given: 27 | def getDefault = TimeZone.getDefault() 28 | TimeZone.setDefault(SimpleTimeZone.getTimeZone(ZoneOffset.ofHours(2))) 29 | def report = new TestExecutionScheduleReportBuilder() 30 | .addResult('class', 'test', toEpochMilli('2023-03-10T19:00:02Z'), toEpochMilli('2023-03-10T19:00:05Z'), 'passed', TEST) 31 | .addMark('mark1', toEpochMilli('2023-03-10T19:00:05Z')).build() 32 | 33 | when: 34 | reporter.report(report, baseDir, "taskname") 35 | 36 | then: 37 | def reportFile = new File(baseDir, "$configOutputLocation/taskname.txt") 38 | reportFile.text == 39 | """|gantt 40 | |dateFormat YYYY-MM-DDTHH:mm:ss.SSSZZ 41 | |axisFormat %H:%M:%S.%L 42 | |section class 43 | |test - 3000 ms :2023-03-10T21:00:02.000+0200, 2023-03-10T21:00:05.000+0200 44 | |mark1 : milestone, 2023-03-10T21:00:05.000+0200, 0 45 | |""".stripMargin() 46 | 47 | cleanup: 48 | TimeZone.setDefault(getDefault) 49 | } 50 | 51 | private static long toEpochMilli(String instant) { 52 | Instant.parse(instant).toEpochMilli() 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/test/groovy/io/github/platan/tests_execution_chart/reporters/mermaid/TestExecutionMermaidDiagramFormatterSpec.groovy: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.mermaid 2 | 3 | import io.github.platan.tests_execution_chart.report.TestExecutionScheduleReportBuilder 4 | import io.github.platan.tests_execution_chart.report.data.Mark 5 | import spock.lang.Specification 6 | 7 | import java.time.ZoneOffset 8 | 9 | import static io.github.platan.tests_execution_chart.report.data.TimedTestResult.Type.SUITE 10 | import static io.github.platan.tests_execution_chart.report.data.TimedTestResult.Type.TEST 11 | 12 | class TestExecutionMermaidDiagramFormatterSpec extends Specification { 13 | 14 | def "should format report with test results"() { 15 | given: 16 | def getDefault = TimeZone.getDefault() 17 | TimeZone.setDefault(SimpleTimeZone.getTimeZone(ZoneOffset.ofHours(2))) 18 | def reportBuilder = new TestExecutionScheduleReportBuilder() 19 | .addResult('Test1', 'test1', 1681402397000, 1681402397100, 'SUCCESS', TEST) 20 | .addResult('Test1', 'test2', 1681402397100, 1681402397300, 'SUCCESS', TEST) 21 | .addResult('Test1', 'suite', 1681402397000, 1681402397300, 'SUCCESS', SUITE) 22 | .addResult('Test2', 'test1', 1681402397000, 1681402397100, 'FAILURE', TEST) 23 | .addResult('Test2', 'suite', 1681402397000, 1681402397300, 'FAILURE', SUITE) 24 | .addResult('Test3', 'test1', 1681402397100, 1681402397300, 'SKIPPED', TEST) 25 | .addResult('Test3', 'suite', 1681402397000, 1681402397300, 'SKIPPED', SUITE) 26 | def report = reportBuilder.build() 27 | 28 | when: 29 | def mermaidReport = new TestExecutionMermaidDiagramFormatter().format(report) 30 | 31 | 32 | def indent = """gantt 33 | dateFormat YYYY-MM-DDTHH:mm:ss.SSSZZ 34 | axisFormat %H:%M:%S.%L 35 | section Test1 36 | test1 - 100 ms :active, 2023-04-13T18:13:17.000+0200, 2023-04-13T18:13:17.100+0200 37 | test2 - 200 ms :active, 2023-04-13T18:13:17.100+0200, 2023-04-13T18:13:17.300+0200 38 | suite - 300 ms :done, 2023-04-13T18:13:17.000+0200, 2023-04-13T18:13:17.300+0200 39 | section Test2 40 | test1 - 100 ms :crit, 2023-04-13T18:13:17.000+0200, 2023-04-13T18:13:17.100+0200 41 | suite - 300 ms :crit,done, 2023-04-13T18:13:17.000+0200, 2023-04-13T18:13:17.300+0200 42 | section Test3 43 | test1 - 200 ms :2023-04-13T18:13:17.100+0200, 2023-04-13T18:13:17.300+0200 44 | suite - 300 ms :2023-04-13T18:13:17.000+0200, 2023-04-13T18:13:17.300+0200 45 | """ 46 | then: 47 | mermaidReport == indent 48 | 49 | cleanup: 50 | TimeZone.setDefault(getDefault) 51 | } 52 | 53 | def "should format report with test results and marks"() { 54 | given: 55 | def getDefault = TimeZone.getDefault() 56 | TimeZone.setDefault(SimpleTimeZone.getTimeZone(ZoneOffset.ofHours(2))) 57 | def reportBuilder = new TestExecutionScheduleReportBuilder() 58 | .addResult('Test1', 'test1', 1681402397000, 1681402397100, 'SUCCESS', TEST) 59 | .addResult('Test1', 'test2', 1681402397100, 1681402397300, 'SUCCESS', TEST) 60 | .addResult('Test2', 'test1', 1681402397000, 1681402397100, 'SUCCESS', TEST) 61 | def results = reportBuilder.build() 62 | def report = results.copy(results.results, [new Mark('mark1', 1681402397400)]) 63 | 64 | when: 65 | def mermaidReport = new TestExecutionMermaidDiagramFormatter().format(report) 66 | 67 | 68 | def indent = """gantt 69 | dateFormat YYYY-MM-DDTHH:mm:ss.SSSZZ 70 | axisFormat %H:%M:%S.%L 71 | section Test1 72 | test1 - 100 ms :active, 2023-04-13T18:13:17.000+0200, 2023-04-13T18:13:17.100+0200 73 | test2 - 200 ms :active, 2023-04-13T18:13:17.100+0200, 2023-04-13T18:13:17.300+0200 74 | section Test2 75 | test1 - 100 ms :active, 2023-04-13T18:13:17.000+0200, 2023-04-13T18:13:17.100+0200 76 | mark1 : milestone, 2023-04-13T18:13:17.400+0200, 0 77 | """ 78 | then: 79 | mermaidReport == indent 80 | 81 | cleanup: 82 | TimeZone.setDefault(getDefault) 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/test/groovy/io/github/platan/tests_execution_chart/reporters/mermaid/core/MermaidGanttDiagramBuilderTest.groovy: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.mermaid.core 2 | 3 | import spock.lang.Specification 4 | 5 | class MermaidGanttDiagramBuilderTest extends Specification { 6 | 7 | def "should return error for blank mark name"() { 8 | when: 9 | new MermaidGanttDiagram.MermaidGanttDiagramBuilder().addMilestone(name, 0) 10 | 11 | then: 12 | def e = thrown(IllegalArgumentException) 13 | e.message == 'Mark name cannot be blank' 14 | 15 | where: 16 | name << ['', ' '] 17 | } 18 | 19 | def "should return error for blank task name"() { 20 | when: 21 | new MermaidGanttDiagram.MermaidGanttDiagramBuilder().addTask(name, 'active', 0, 1) 22 | 23 | then: 24 | def e = thrown(IllegalArgumentException) 25 | e.message == 'Task name cannot be blank' 26 | 27 | where: 28 | name << ['', ' '] 29 | } 30 | 31 | def "should return error for blank section name"() { 32 | when: 33 | new MermaidGanttDiagram.MermaidGanttDiagramBuilder().addSection(name) 34 | 35 | then: 36 | def e = thrown(IllegalArgumentException) 37 | e.message == 'Section name cannot be blank' 38 | 39 | where: 40 | name << ['', ' '] 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tests-execution-chart-commons/src/test/groovy/io/github/platan/tests_execution_chart/reporters/mermaid/core/MermaidGanttDiagramFormatterTest.groovy: -------------------------------------------------------------------------------- 1 | package io.github.platan.tests_execution_chart.reporters.mermaid.core 2 | 3 | 4 | import spock.lang.Specification 5 | 6 | import java.time.ZoneOffset 7 | 8 | class MermaidGanttDiagramFormatterTest extends Specification { 9 | 10 | def "should format report"() { 11 | given: 12 | def getDefault = TimeZone.getDefault() 13 | TimeZone.setDefault(SimpleTimeZone.getTimeZone(ZoneOffset.ofHours(2))) 14 | def diagramBuilder = new MermaidGanttDiagram.MermaidGanttDiagramBuilder() 15 | diagramBuilder.addSection('Test1') 16 | diagramBuilder.addTask('test1 - 100 ms', 'active', 1681402397000, 1681402397100) 17 | diagramBuilder.addTask('test2 - 200 ms', 'active', 1681402397100, 1681402397300) 18 | diagramBuilder.addMilestone('milestone1', 1681402397100) 19 | diagramBuilder.addSection('Test2') 20 | diagramBuilder.addTask('test1 - 100 ms', 'active', 1681402397000, 1681402397100) 21 | diagramBuilder.addMilestone('milestone2', 1681402397400) 22 | 23 | MermaidGanttDiagram diagram = diagramBuilder.build("YYYY-MM-DDTHH:mm:ss.SSSZZ", "%H:%M:%S.%L") 24 | 25 | when: 26 | def mermaidReport = new MermaidGanttDiagramFormatter().format(diagram, "yyyy-MM-dd'T'HH:mm:ss.SSSZ") 27 | 28 | 29 | def indent = """gantt 30 | dateFormat YYYY-MM-DDTHH:mm:ss.SSSZZ 31 | axisFormat %H:%M:%S.%L 32 | section Test1 33 | test1 - 100 ms :active, 2023-04-13T18:13:17.000+0200, 2023-04-13T18:13:17.100+0200 34 | test2 - 200 ms :active, 2023-04-13T18:13:17.100+0200, 2023-04-13T18:13:17.300+0200 35 | milestone1 : milestone, 2023-04-13T18:13:17.100+0200, 0 36 | section Test2 37 | test1 - 100 ms :active, 2023-04-13T18:13:17.000+0200, 2023-04-13T18:13:17.100+0200 38 | milestone2 : milestone, 2023-04-13T18:13:17.400+0200, 0 39 | """ 40 | then: 41 | mermaidReport == indent 42 | 43 | cleanup: 44 | TimeZone.setDefault(getDefault) 45 | } 46 | 47 | def "should format report with special characters"() { 48 | given: 49 | def getDefault = TimeZone.getDefault() 50 | TimeZone.setDefault(SimpleTimeZone.getTimeZone(ZoneOffset.ofHours(2))) 51 | def diagramBuilder = new MermaidGanttDiagram.MermaidGanttDiagramBuilder() 52 | diagramBuilder.addSection('Test # ; : 1') 53 | diagramBuilder.addTask('test # ; : 1', 'active', 1681402397000, 1681402397100) 54 | diagramBuilder.addMilestone('milestone # ; : 1', 1681402397100) 55 | 56 | MermaidGanttDiagram diagram = diagramBuilder.build("YYYY-MM-DDTHH:mm:ss.SSSZZ", "%H:%M:%S.%L") 57 | 58 | when: 59 | def mermaidReport = new MermaidGanttDiagramFormatter().format(diagram, "yyyy-MM-dd'T'HH:mm:ss.SSSZ") 60 | 61 | 62 | def indent = """gantt 63 | dateFormat YYYY-MM-DDTHH:mm:ss.SSSZZ 64 | axisFormat %H:%M:%S.%L 65 | section Test #35; #semi; #colon; 1 66 | test #35; #semi; #colon; 1 :active, 2023-04-13T18:13:17.000+0200, 2023-04-13T18:13:17.100+0200 67 | milestone #35; #semi; #colon; 1 : milestone, 2023-04-13T18:13:17.100+0200, 0 68 | """ 69 | then: 70 | mermaidReport == indent 71 | 72 | cleanup: 73 | TimeZone.setDefault(getDefault) 74 | } 75 | } 76 | --------------------------------------------------------------------------------