{"id":48756040,"url":"https://github.com/mtgleeson/tiatesting","last_synced_at":"2026-05-04T06:06:17.499Z","repository":{"id":236608695,"uuid":"428520478","full_name":"mtgleeson/tiatesting","owner":"mtgleeson","description":"Tia is a free test impact analyser library used for selective testing with common test runners such as JUnit and Spock.","archived":false,"fork":false,"pushed_at":"2026-04-13T01:22:41.000Z","size":7615,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-13T02:24:09.528Z","etag":null,"topics":["git","gradle","gradle-plugin","groovy","java","junit","junit-jupiter","junit4","junit5","maven","maven-plugin","perforce","selective-testing","spock","test-automation","test-impact-analysis","testing","testing-tools"],"latest_commit_sha":null,"homepage":"https://github.com/mtgleeson/tiatesting","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtgleeson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-11-16T04:48:31.000Z","updated_at":"2026-04-13T01:22:14.000Z","dependencies_parsed_at":"2024-05-15T19:25:32.652Z","dependency_job_id":"cf30843c-c81c-4eea-89cc-d30751c98505","html_url":"https://github.com/mtgleeson/tiatesting","commit_stats":null,"previous_names":["mtgleeson/tiatesting"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/mtgleeson/tiatesting","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtgleeson%2Ftiatesting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtgleeson%2Ftiatesting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtgleeson%2Ftiatesting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtgleeson%2Ftiatesting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtgleeson","download_url":"https://codeload.github.com/mtgleeson/tiatesting/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtgleeson%2Ftiatesting/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31824118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"online","status_checked_at":"2026-04-15T02:00:06.175Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","gradle","gradle-plugin","groovy","java","junit","junit-jupiter","junit4","junit5","maven","maven-plugin","perforce","selective-testing","spock","test-automation","test-impact-analysis","testing","testing-tools"],"created_at":"2026-04-13T02:16:27.392Z","updated_at":"2026-05-04T06:06:17.481Z","avatar_url":"https://github.com/mtgleeson.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tia Java Selective Testing Library\nTia is a free library used for selective testing with common test runners such as JUnit and Spock. Tia is distributed under the Apache 2.0 license.\nTia (pronounced Tee-ä, or Tina without the 'n') stands for test impact analysis. \n\n## Starting Points\n- [Getting started](#getting-started)\n\t- [Maven, Junit5, Git](#maven-junit5-and-git)\n  \t- [Maven, Junit5, Perforce](#maven-junit5-and-perforce)\n  \t- [Maven, Junit4, Git](#maven-junit4-and-git)\n  \t- [Maven, Junit4, Perforce](#maven-junit4-and-perforce)\n  \t- [Gradle, Spock, Git](#gradle-spock-and-git)\n- [Usage](#usage)\n- [Configuration Options](#configuration-options)\n- [What is Tia](#what-is-tia)\n- [How Does Tia Work](#how-does-tia-work)\n- [Supported Build Automation Tools, VCS and Test Runners](#supported-build-automation-tools-vcs-and-test-runners)\n- [Credits](#credits)\n- [Additional resources and solutions](#additional-resources-and-solutions)\n- [Bug Report](https://github.com/mtgleeson/tiatesting/issues)\n- [Feature Request](https://github.com/mtgleeson/tiatesting/issues)\n\n## Getting Started\n\n### Maven, JUnit5 and Git\n1. Registering the Tia LaunchSessionListener.\n   \nTia uses a LauncherSessionListener to plugin to the Junit5 framework for updating test coverage mappings and stats. To register the Tia LaunchSessionListener use Java’s [ServiceLoader](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/ServiceLoader.html) mechanism. Create a file called org.junit.platform.launcher.LauncherSessionListener in the /test/resources/META-INF/services folder of your test project. This file should contain the list of of Junit5 session listeners. Add the following line to this file (if you already have this file, add the following as a separate line).\n\n`/test/resources/META-INF/services/org.junit.platform.launcher.LauncherSessionListener`\n```\norg.tiatesting.junit.junit5.TiaLauncherSessionListener\n```\n\n2. Congifuring your test project POM for Tia.\nInclude the following configuration in the project where you execute your tests. The following configuration is for Surefire, but Tia can be configured with Failsafe as well.\nFor the latest versions, see [tia-junit5-git-maven-plugin](https://central.sonatype.com/search?q=g%3Aorg.tiatesting+a%3Atia-junit5-git-maven-plugin\u0026smo=true) and [tia-junit5-git](https://central.sonatype.com/search?q=g%3Aorg.tiatesting+a%3Atia-junit5-git\u0026smo=true).\n\n**Note:** If your tests live in the same project as your source code, you need to include and configure Jacoco to run in TCP server mode (see below). If your source code lives in a different project to your tests, you need to ensure your project that contains your source code is configured to run with Jacoco in TCP server mode. You can then omit the Jacoco configuration below from your test project pom.xml.\n\n`pom.xml`\n```xml\n\u003cproperties\u003e\n    \u003ctiaEnabled\u003etrue\u003c/tiaEnabled\u003e\n    \u003ctiaUpdateDBMapping\u003etrue\u003c/tiaUpdateDBMapping\u003e\n    \u003ctiaUpdateDBStats\u003etrue\u003c/tiaUpdateDBStats\u003e\n    \u003ctiaCheckLocalChanges\u003efalse\u003c/tiaCheckLocalChanges\u003e\n    \u003ctiaProjectDir\u003e.\u003c/tiaProjectDir\u003e\n    \u003ctiaClassFilesDirs\u003e/target/classes\u003c/tiaClassFilesDirs\u003e\n    \u003ctiaSourceFilesDirs\u003e/src/main/java\u003c/tiaSourceFilesDirs\u003e\n    \u003ctiaTestFilesDirs\u003e/src/test/java\u003c/tiaTestFilesDirs\u003e\n    \u003ctiaDBFilePath\u003e/some/path\u003c/tiaDBFilePath\u003e    \n\u003c/properties\u003e\n\n\u003cdependencies\u003e\n    \u003c!-- tia-junit5-git is needed for the Tia test listener used by Surefire/Failsafe. --\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.tiatesting\u003c/groupId\u003e\n        \u003cartifactId\u003etia-junit5-git\u003c/artifactId\u003e\n        \u003cversion\u003e0.1.14\u003c/version\u003e\n        \u003cscope\u003etest\u003c/scope\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n\n\u003cbuild\u003e\n    \u003cplugins\u003e        \n        \u003cplugin\u003e\n            \u003c!-- Include the Maven plugin, used to select which tests to run and ignore the rest. --\u003e\n            \u003cgroupId\u003eorg.tiatesting\u003c/groupId\u003e\n            \u003cartifactId\u003etia-junit5-git-maven-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e0.1.14\u003c/version\u003e\n            \u003cexecutions\u003e\n                \u003cexecution\u003e\n                    \u003cid\u003epre-test\u003c/id\u003e\n                    \u003cgoals\u003e\n                        \u003cgoal\u003eprepare-agent\u003c/goal\u003e\n                    \u003c/goals\u003e\n                    \u003cphase\u003etest-compile\u003c/phase\u003e\n                \u003c/execution\u003e\n            \u003c/executions\u003e\n            \u003cconfiguration\u003e\n                \u003ctiaProjectDir\u003e${tiaProjectDir}\u003c/tiaProjectDir\u003e\n                \u003ctiaDBFilePath\u003e${tiaDBFilePath}\u003c/tiaDBFilePath\u003e\n                \u003ctiaSourceFilesDirs\u003e${tiaSourceFilesDirs}\u003c/tiaSourceFilesDirs\u003e\n                \u003ctiaTestFilesDirs\u003e${tiaTestFilesDirs}\u003c/tiaTestFilesDirs\u003e                \n                \u003ctiaCheckLocalChanges\u003e${tiaCheckLocalChanges}\u003c/tiaCheckLocalChanges\u003e\n                \u003ctiaEnabled\u003e${tiaEnabled}\u003c/tiaEnabled\u003e\n            \u003c/configuration\u003e\n        \u003c/plugin\u003e\n        \u003cplugin\u003e\n            \u003c!-- Configure Surefire to use Tia. Used to update the Tia test to source code mapping and/or stats when running the tests. --\u003e\n            \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n            \u003cartifactId\u003emaven-surefire-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e3.5.2\u003c/version\u003e\n            \u003cconfiguration\u003e\n                \u003cincludes\u003e\n                    \u003cinclude\u003e**/*Test.java\u003c/include\u003e\n                \u003c/includes\u003e\n                \u003csystemPropertyVariables\u003e\n                    \u003ctiaProjectDir\u003e${tiaProjectDir}\u003c/tiaProjectDir\u003e\n                    \u003ctiaClassFilesDirs\u003e${tiaClassFilesDirs}\u003c/tiaClassFilesDirs\u003e\n                    \u003ctiaDBFilePath\u003e${tiaDBFilePath}\u003c/tiaDBFilePath\u003e\n                    \u003ctiaEnabled\u003e${tiaEnabled}\u003c/tiaEnabled\u003e\n                    \u003ctiaUpdateDBMapping\u003e${tiaUpdateDBMapping}\u003c/tiaUpdateDBMapping\u003e\n                    \u003ctiaUpdateDBStats\u003e${tiaUpdateDBStats}\u003c/tiaUpdateDBStats\u003e\n                    \u003ctestClassesDir\u003e${project.build.testOutputDirectory}\u003c/testClassesDir\u003e\n                \u003c/systemPropertyVariables\u003e\n            \u003c/configuration\u003e\n        \u003c/plugin\u003e\n        \u003cplugin\u003e\n            \u003c!-- Configure Jacoco as a TCP server, needed by Tia (which has a Jacoco client) for collecting the coverage data for each test suite. --\u003e\n            \u003cgroupId\u003eorg.jacoco\u003c/groupId\u003e\n            \u003cartifactId\u003ejacoco-maven-plugin\u003c/artifactId\u003e            \n            \u003cversion\u003e0.8.7\u003c/version\u003e\n            \u003cexecutions\u003e\n                \u003cexecution\u003e\n                    \u003cid\u003epre-test\u003c/id\u003e\n                    \u003cgoals\u003e\n                        \u003cgoal\u003eprepare-agent\u003c/goal\u003e\n                    \u003c/goals\u003e\n                    \u003cphase\u003etest-compile\u003c/phase\u003e\n                    \u003cconfiguration\u003e\n                        \u003coutput\u003etcpserver\u003c/output\u003e\n                    \u003c/configuration\u003e\n                \u003c/execution\u003e\n            \u003c/executions\u003e\n        \u003c/plugin\u003e\n    \u003c/plugins\u003e\n\u003c/build\u003e\n```\n\n### Maven, JUnit5 and Perforce\nUse the configuration documented above for [Maven, Junit5 and Git](https://github.com/mtgleeson/tiatesting/edit/main/README.md#getting-started), but replace `tia-junit5-git` with `tia-junit5-perforce` and `tia-junit5-git-maven-plugin` with `tia-junit5-perforce-maven-plugin`.\n\nFor the latest versions, see [tia-junit5-perforce-maven-plugin](https://central.sonatype.com/search?q=g%3Aorg.tiatesting+a%3Atia-junit5-perforce-maven-plugin\u0026smo=true) and [tia-junit5-perforce](https://central.sonatype.com/search?q=g%3Aorg.tiatesting+a%3Atia-junit5-perforce\u0026smo=true).\n\n### Maven, JUnit4 and Git\nInclude the following configuration in the project where you execute your tests. The following configuration is for Surefire, but Tia can be configured with Failsafe as well.\nFor the latest versions, see [tia-junit4-git-maven-plugin](https://central.sonatype.com/search?q=g%3Aorg.tiatesting+a%3Atia-junit4-git-maven-plugin\u0026smo=true) and [tia-junit4-git](https://central.sonatype.com/search?q=g%3Aorg.tiatesting+a%3Atia-junit4-git\u0026smo=true).\n\n**Note:** If your tests live in the same project as your source code, you need to include and configure Jacoco to run in TCP server mode (see below). If your source code lives in a different project to your tests, you need to ensure your project that contains your source code is configured to run with Jacoco in TCP server mode. You can then omit the Jacoco configuration below from your test project pom.xml.\n\n`pom.xml`\n```xml\n\u003cproperties\u003e\n    \u003ctiaEnabled\u003etrue\u003c/tiaEnabled\u003e\n    \u003ctiaUpdateDBMapping\u003etrue\u003c/tiaUpdateDBMapping\u003e\n    \u003ctiaUpdateDBStats\u003etrue\u003c/tiaUpdateDBStats\u003e\n    \u003ctiaCheckLocalChanges\u003efalse\u003c/tiaCheckLocalChanges\u003e\n    \u003ctiaProjectDir\u003e.\u003c/tiaProjectDir\u003e\n    \u003ctiaClassFilesDirs\u003e/target/classes\u003c/tiaClassFilesDirs\u003e\n    \u003ctiaSourceFilesDirs\u003e/src/main/java\u003c/tiaSourceFilesDirs\u003e\n    \u003ctiaTestFilesDirs\u003e/src/test/java\u003c/tiaTestFilesDirs\u003e\n    \u003ctiaDBFilePath\u003e/some/path\u003c/tiaDBFilePath\u003e    \n\u003c/properties\u003e\n\n\u003cdependencies\u003e\n    \u003c!-- tia-junit4-git is needed for the Tia test listener used by Surefire/Failsafe. --\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.tiatesting\u003c/groupId\u003e\n        \u003cartifactId\u003etia-junit4-git\u003c/artifactId\u003e\n        \u003cversion\u003e0.1.14\u003c/version\u003e\n        \u003cscope\u003etest\u003c/scope\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n\n\u003cbuild\u003e\n    \u003cplugins\u003e        \n        \u003cplugin\u003e\n            \u003c!-- Include the Maven plugin, used to select which tests to run and ignore the rest. --\u003e\n            \u003cgroupId\u003eorg.tiatesting\u003c/groupId\u003e\n            \u003cartifactId\u003etia-junit4-git-maven-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e0.1.14\u003c/version\u003e\n            \u003cexecutions\u003e\n                \u003cexecution\u003e\n                    \u003cid\u003epre-test\u003c/id\u003e\n                    \u003cgoals\u003e\n                        \u003cgoal\u003eprepare-agent\u003c/goal\u003e\n                    \u003c/goals\u003e\n                    \u003cphase\u003etest-compile\u003c/phase\u003e\n                \u003c/execution\u003e\n            \u003c/executions\u003e\n            \u003cconfiguration\u003e\n                \u003ctiaProjectDir\u003e${tiaProjectDir}\u003c/tiaProjectDir\u003e\n                \u003ctiaDBFilePath\u003e${tiaDBFilePath}\u003c/tiaDBFilePath\u003e\n                \u003ctiaSourceFilesDirs\u003e${tiaSourceFilesDirs}\u003c/tiaSourceFilesDirs\u003e\n                \u003ctiaTestFilesDirs\u003e${tiaTestFilesDirs}\u003c/tiaTestFilesDirs\u003e                \n                \u003ctiaCheckLocalChanges\u003e${tiaCheckLocalChanges}\u003c/tiaCheckLocalChanges\u003e\n                \u003ctiaEnabled\u003e${tiaEnabled}\u003c/tiaEnabled\u003e\n            \u003c/configuration\u003e\n        \u003c/plugin\u003e\n        \u003cplugin\u003e\n            \u003c!-- Configure Surefire to use Tia. Used to update the Tia test to source code mapping and/or stats when running the tests. --\u003e\n            \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n            \u003cartifactId\u003emaven-surefire-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e2.19\u003c/version\u003e\n            \u003cconfiguration\u003e\n                \u003cincludes\u003e\n                    \u003cinclude\u003e**/*Test.java\u003c/include\u003e\n                \u003c/includes\u003e\n                \u003csystemPropertyVariables\u003e\n                    \u003ctiaProjectDir\u003e${tiaProjectDir}\u003c/tiaProjectDir\u003e\n                    \u003ctiaClassFilesDirs\u003e${tiaClassFilesDirs}\u003c/tiaClassFilesDirs\u003e\n                    \u003ctiaDBFilePath\u003e${tiaDBFilePath}\u003c/tiaDBFilePath\u003e\n                    \u003ctiaEnabled\u003e${tiaEnabled}\u003c/tiaEnabled\u003e\n                    \u003ctiaUpdateDBMapping\u003e${tiaUpdateDBMapping}\u003c/tiaUpdateDBMapping\u003e\n                    \u003ctiaUpdateDBStats\u003e${tiaUpdateDBStats}\u003c/tiaUpdateDBStats\u003e\n                    \u003ctestClassesDir\u003e${project.build.testOutputDirectory}\u003c/testClassesDir\u003e\n                \u003c/systemPropertyVariables\u003e\n                \u003cproperties\u003e\n                    \u003cproperty\u003e\n                        \u003cname\u003elistener\u003c/name\u003e\n                        \u003cvalue\u003eorg.tiatesting.junit.junit4.TiaJunit4GitListener\u003c/value\u003e\n                    \u003c/property\u003e\n                \u003c/properties\u003e\n            \u003c/configuration\u003e\n        \u003c/plugin\u003e\n        \u003cplugin\u003e\n            \u003c!-- Configure Jacoco as a TCP server, needed by Tia (which has a Jacoco client) for collecting the coverage data for each test suite. --\u003e\n            \u003cgroupId\u003eorg.jacoco\u003c/groupId\u003e\n            \u003cartifactId\u003ejacoco-maven-plugin\u003c/artifactId\u003e            \n            \u003cversion\u003e0.8.7\u003c/version\u003e\n            \u003cexecutions\u003e\n                \u003cexecution\u003e\n                    \u003cid\u003epre-test\u003c/id\u003e\n                    \u003cgoals\u003e\n                        \u003cgoal\u003eprepare-agent\u003c/goal\u003e\n                    \u003c/goals\u003e\n                    \u003cphase\u003etest-compile\u003c/phase\u003e\n                    \u003cconfiguration\u003e\n                        \u003coutput\u003etcpserver\u003c/output\u003e\n                    \u003c/configuration\u003e\n                \u003c/execution\u003e\n            \u003c/executions\u003e\n        \u003c/plugin\u003e\n    \u003c/plugins\u003e\n\u003c/build\u003e\n```\n\n### Maven, JUnit4 and Perforce\nUse the configuration documented above for [Maven, Junit4 and Git](https://github.com/mtgleeson/tiatesting/edit/main/README.md#getting-started), but replace `tia-junit4-git` with `tia-junit4-perforce` and `tia-junit4-git-maven-plugin` with `tia-junit4-perforce-maven-plugin`.\n\nFor the latest versions, see [tia-junit4-perforce-maven-plugin](https://central.sonatype.com/search?q=g%3Aorg.tiatesting+a%3Atia-junit4-perforce-maven-plugin\u0026smo=true) and [tia-junit4-perforce](https://central.sonatype.com/search?q=g%3Aorg.tiatesting+a%3Atia-junit4-perforce\u0026smo=true).\n\n### Gradle, Spock and Git\nInclude the following configuration in your project where you execute your tests. \nFor the latest version, see [tia-spock-git-gradle](https://central.sonatype.com/search?q=g%3Aorg.tiatesting+a%3Atia-spock-git-gradle\u0026smo=true).\n\n`settings.gradle`\n```\nbuildscript {\n    repositories {      \n        mavenCentral()\n    }\n    dependencies {\n        classpath 'org.tiatesting:tia-spock-git-gradle:0.1.14'\n    }\n}\n```\n\n`build.gradle`\n```\nplugins {\n    id 'org.tiatesting.spock.gradle.git'\n}\n\nrepositories {\n    mavenCentral()\n}\n\n// global Tia config applied to all tasks of type test\ntia {\n    enabled = true    \n    updateDBMapping = true\n    updateDBStats = true\n    checkLocalChanges = true\n    projectDir = \".\"\n    classFilesDirs =\"/build/classes/java/main\"\n    sourceFilesDirs =\"/src/main/java\"\n    testFilesDirs =\"/src/test/groovy\"\n    dbFilePath = \"/some/path\"        \n}\n\n// you can optionally override the Tia config per test task type\ntest {\n    tia {\n        enabled = true\n        checkLocalChanges = true\n        updateDBMapping = true\n        updateDBStats = true\n    }\n}\n```\n\n### Tracking coverage for libraries\nIf your source project depends on in-repo libraries (also published as artifacts in the same repository) and you want Tia to track and react to changes in those libraries too, use the `sourceLibs` configuration. Tia resolves the `groupId:artifactId` coordinates against the source project's resolved dependencies, locates the matching JAR file for the version actually in use, and adds it to Jacoco's analysis so library classes are included in the test-to-source mapping.\n\nAdd the library source directories to `sourceFilesDirs` as well, so VCS diff and method-impact analysis picks up library changes. If the project running the tests is different from the source project, point `sourceProjectDir` at the source project's root.\n\n**Build-system restriction**: when the test project and source project are separate, they must use the same build system. A Maven test project can only resolve `sourceLibs` against a Maven source project, and a Gradle test project can only resolve against a Gradle source project. Cross-build-system setups are not currently supported — please open an issue if you need them.\n\n#### Maven\nThe Maven plugin reads the source project's resolved dependencies by loading its `pom.xml` via Maven. `tiaSourceProjectDir` must therefore point at a directory containing a `pom.xml`.\n\n`pom.xml`\n```xml\n\u003cproperties\u003e\n    \u003c!-- ...existing Tia properties... --\u003e\n    \u003ctiaSourceLibs\u003ecom.example:my-lib:/path/to/my-lib,com.example:other-lib:/path/to/other-lib\u003c/tiaSourceLibs\u003e\n    \u003c!-- optional: only needed when the test project differs from the source project --\u003e\n    \u003ctiaSourceProjectDir\u003e/absolute/path/to/source-project\u003c/tiaSourceProjectDir\u003e\n    \u003c!-- optional: BUMP_AFTER_RELEASE (default) or BUMP_AT_RELEASE — see policy description below --\u003e\n    \u003ctiaLibraryVersionPolicy\u003eBUMP_AFTER_RELEASE\u003c/tiaLibraryVersionPolicy\u003e\n\u003c/properties\u003e\n\n\u003cbuild\u003e\n    \u003cplugins\u003e\n        \u003cplugin\u003e\n            \u003cgroupId\u003eorg.tiatesting\u003c/groupId\u003e\n            \u003cartifactId\u003etia-junit5-git-maven-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e0.1.14\u003c/version\u003e\n            \u003cconfiguration\u003e\n                \u003c!-- ...existing Tia plugin configuration... --\u003e\n                \u003ctiaSourceLibs\u003e${tiaSourceLibs}\u003c/tiaSourceLibs\u003e\n                \u003ctiaSourceProjectDir\u003e${tiaSourceProjectDir}\u003c/tiaSourceProjectDir\u003e\n                \u003ctiaLibraryVersionPolicy\u003e${tiaLibraryVersionPolicy}\u003c/tiaLibraryVersionPolicy\u003e\n            \u003c/configuration\u003e\n        \u003c/plugin\u003e\n    \u003c/plugins\u003e\n\u003c/build\u003e\n```\n\n#### Gradle\nThe Gradle plugin supports three source-project configurations:\n\n1. **Same project** — `sourceProjectDir` is omitted (or points at the current project). The plugin resolves coordinates against the current project's `runtimeClasspath`.\n2. **Sibling subproject** — `sourceProjectDir` points at another subproject in the same Gradle build. The plugin resolves against that subproject's `runtimeClasspath`.\n3. **External Gradle build** — `sourceProjectDir` points at a separate Gradle project on disk (but in the same VCS repository). The plugin uses the Gradle Tooling API to load that project and read its resolved classpath, which spins up a short Gradle daemon against the source project on first use (so the source project must be buildable). When tracking an in-repo library (`sourceLibs` entry pointing at an external Gradle build), the library project must apply a publishing plugin (`maven-publish` or `ivy-publish`) and declare a publication — Tia reads its declared version from the publication, since a project's own classpath cannot list itself.\n\n`build.gradle`\n```gradle\ntia {\n    // ...existing Tia configuration...\n    sourceLibs = 'com.example:my-lib,com.example:other-lib'\n    // optional: only needed when the source project differs from the test project\n    sourceProjectDir = '/absolute/path/to/source-project'\n    // optional: BUMP_AFTER_RELEASE (default) or BUMP_AT_RELEASE — see policy description below\n    libraryVersionPolicy = 'BUMP_AFTER_RELEASE'\n}\n```\n\nThe Gradle plugin pre-resolves library metadata (declared version, source directories, resolved version, JAR path) at task-action time and forwards it to the forked test JVM via system properties — TIA's library partitioning, reconcile, stamp, and drain phases all run inside the test JVM as part of Spock's selection lifecycle. No state is exchanged via files; the wire format is internal and not part of the public configuration surface.\n\n**Single-fork requirement when `updateDBMapping=true`.** The Gradle/Spock path must run with `maxParallelForks=1` and `forkEvery=0` (Gradle's defaults) when persisting mapping data. Each forked JVM persists independently using only the test suites it observed, so multi-fork runs corrupt the on-disk mapping by deleting the suites other forks owned. This affects test-suite-mapping persistence in general (not specific to library tracking) — leaving Gradle's defaults in place avoids it.\n\n#### How library change tracking works (stamp/drain)\n\nWhen a tracked library's source code changes in VCS, Tia does **not** run the impacted tests immediately. Instead, it uses a two-phase stamp/drain approach:\n\n**Stamp phase (at commit analysis time):** When Tia detects source changes in a tracked library's directory, it identifies the impacted source methods and records them as *pending* in the Tia database, tagged with the library's current declared version (and a JAR content hash for SNAPSHOT versions). No tests are added to the run set at this point — the source project may still be consuming an older version of the library, so running the tests now would exercise stale code and produce a false green result.\n\n**Drain phase (at test selection time):** On each test run, Tia checks whether the source project has caught up to any pending library versions:\n- **Release versions:** A pending batch drains when the source project's resolved library version is \u003e= the stamped version AND differs from the last version Tia saw on the source project. The \"differs\" check prevents re-draining when the library's source changes are committed but the version number hasn't been bumped yet.\n- **SNAPSHOT versions:** A pending batch drains when the SHA-256 hash of the resolved JAR file differs from the last hash Tia tracked. This detects new SNAPSHOT builds even though the version string stays the same.\n\nWhen a batch drains, Tia resolves which test suites exercise the pending method IDs using the **current** test-to-source mapping (not the mapping from stamp time), then adds those tests to the run set. After the test run completes successfully, the drained pending rows are deleted and the library's last-seen version/hash is updated.\n\n**Local changes mode (`checkLocalChanges=true`):** Library diff partitioning is bypassed entirely — all changes (including library changes) are treated as source-project changes and impacted tests run immediately. No pending rows are read or written. This is the expected behavior for local development where you want instant feedback.\n\n**Library removal:** If a library is removed from the `sourceLibs` configuration, Tia deletes the tracked library row and all its pending batches are automatically cascade-deleted.\n\n**Primary build requirement:** The Tia run that persists mapping-DB updates (typically the primary CI run for your branch) must operate on a clean working tree. Tia resolves each tracked library's version from the source project's current on-disk build file (e.g. `pom.xml`, `build.gradle`). An uncommitted version bump is indistinguishable from a committed one at drain time, so running the persisting build with local build-file changes can cause a pending batch to drain against a version not yet in VCS — leading to incorrect test selection on subsequent runs. For local development, use `checkLocalChanges=true` (see above); the drain is bypassed in that mode.\n\n**Release cadence — run Tia on every release:** The stamp/drain model assumes Tia observes every released library version. Multiple commits within the same release cycle are safely aggregated into a single pending batch, but a diff range that spans two releases cannot be correctly classified — the stamper reads only the library's current build-file state, not the commit history, so intermediate releases are invisible to it. In practice this means Tia must run at least once against every released state of each tracked library (typically every primary CI run is sufficient).\n\n**Semantic versioning required for libraries:** Tia's version comparison is numeric-per-segment with lexicographic fallback. Version strings like `1.2.3` or `1.2.3-SNAPSHOT` compare correctly; pre-release qualifiers such as `1.2.0-rc1`, `1.2.0-M1`, or `1.2.0-alpha` will mis-order relative to the base version. Tracked libraries should use plain semantic versioning.\n\n**Library version policy (`libraryVersionPolicy`):** Tia supports two release conventions used in the library's build file, configured globally for all tracked libraries. The default is `BUMP_AFTER_RELEASE`:\n\n- `BUMP_AFTER_RELEASE` *(default)* — the build-file version is the *next* version to be released. Example (Maven release plugin convention): dev on `1.6.0-SNAPSHOT` → release cuts `1.6.0` → bump to `1.7.0-SNAPSHOT`. The declared version always points forward.\n- `BUMP_AT_RELEASE` — the build-file version stays at the *last released* version during dev; the bump happens atomically with each release. Example: released `1.0` → dev commits continue declaring `1.0` → release cuts `1.1` (bump + tag in the same commit) → dev continues on `1.1`. The declared version always points backward.\n\nUnder `BUMP_AT_RELEASE`, changes stamped while the build-file version equals the last observed released version are tagged as destined for the *next, unknown release* and held by the drainer until the library's build-file version advances. Under `BUMP_AFTER_RELEASE` this holding behaviour is not needed and the logic stays as described in the stamp/drain rules above.\n\nSee [`WIKI.md`](WIKI.md) for a full explanation of the model, including worked examples under both policies.\n\n## Usage\n\n### Running Tia\nNothing special is needed to execute Tia. Configure Tia for your build automation tool (Maven, Gradle) and then run your tests as you normally would. Tia will select the tests to run and then hook into the test runner to capture details of the results. \ni.e. mvn test/verify, gradle test. \n\nFor Maven, it's recommended to add the following to your ~/.settings.xml file to allow you to run truncated commands without needing to specify the org.tiatesting plugin group:\n```\n\u003cpluginGroups\u003e\n    \u003cpluginGroup\u003eorg.tiatesting\u003c/pluginGroup\u003e\n\u003c/pluginGroups\u003e\n```\n\n### Status — current state of the Tia DB\nExample output:\n```\nTia Status:\nDB last updated: 03/05/2024 23:05:04 PDT\nTest mapping valid for commit: 70d0624e4c2c6fab629d618f0ac406d5cbf009e3\n\nNumber of tests classes with mappings: 4\nNumber of source methods tracked for tests: 35\nNumber of runs: 1\nAverage run time: 459ms\nNumber of successful runs: 1 (100%)\nNumber of failed runs: 0 (0%)\n\nTracked libraries:\n\tcom.example:libA\n\t\tProject dir: /abs/path/to/libA\n\t\tLast source-project version: 1.0.0\n\t\tLast released version (HWM): 1.0.0\n\nPending failed tests:\n\tnone\n\nPending library changes:\n\tcom.example:libA\n\t\t@ 1.1.0 — 3 methods pending\n```\n\n**Maven, Junit5 and Git**\n```\nmvn tia-junit5-git:status\n```\n\n**Maven, Junit5 and Perforce**\n```\nmvn tia-junit5-perforce:status\n```\n\n**Maven, Junit4 and Git**\n```\nmvn tia-junit4-git:status\n```\n\n**Maven, Junit4 and Perforce**\n```\nmvn tia-junit4-perforce:status\n```\n\n**Gradle, Spock and Git**\n```\ngradle tia-status\n```\n\n\n### Display the selected tests based on the current state of the workspace\nThis will show what tests Tia will select to run based on the current state of the workspace and how Tia is configured.\nExample output:\n```\nSelected tests to run from VCS source changes: [com.example.DoorServiceTest, com.example.ParameterizedTest]\nSelected tests to run from VCS test file changes: []\nSelected tests to run from new test files: []\nRunning previously failed tests: [com.example.DoorServiceTest]\nSelected tests to run: \n\tcom.example.DoorServiceTest\n\tcom.example.ParameterizedTest\n```\n\n**Maven, Junit5 and Git**\n```\ntia-junit5-git:select-tests\n```\n\nNote: to see extra debugging including what test suites are being selected broken down by source methods:\n```\ntia-junit5-git:select-tests -Dorg.slf4j.simpleLogger.log.org.tiatesting=debug\n```\n\n**Maven, Junit5 and Perforce**\n```\ntia-junit5-perforce:select-tests\n```\n\n**Maven, Junit4 and Git**\n```\ntia-junit4-git:select-tests\n```\n\n**Maven, Junit4 and Perforce**\n```\ntia-junit4-perforce:select-tests\n```\n\n**Gradle, Spock and Git**\n```\ngradle tia-select-tests\n```\n\nNote: \nTo see extra informtation about what type of changes trigger the selected tests, run the command with more information:\n```\ngradle tia-select-tests --info\n```\n\nTo see extra debugging including what test suites are being selected broken down by source methods:\n```\ngradle tia-select-tests --debug\n```\n\n### Html Report\nGenerate a HTML report showing the current information about the Tia DB, the test suites and the source code.\n\n*Example of the report summary page:*\n\n\u003ckbd\u003e\u003cimg width=\"529\" border=\"1\" alt=\"Screen Shot 2024-05-14 at 9 42 50 PM\" src=\"https://github.com/mtgleeson/tiatesting/assets/1771850/e43aaf82-ee2d-4e66-ac32-b2fb73669fa9\"\u003e\u003c/kbd\u003e\n\n*Example of the test suites index page:*\n\n\u003ckbd\u003e\u003cimg width=\"1120\" alt=\"Screen Shot 2024-05-14 at 10 12 56 PM\" src=\"https://github.com/mtgleeson/tiatesting/assets/1771850/a057dbfe-5277-48e7-af1f-e7b9e6834b4f\"\u003e\u003c/kbd\u003e\n\n*Example of the source methods index page:*\n\n\u003ckbd\u003e\u003cimg width=\"992\" alt=\"Screen Shot 2024-05-14 at 10 04 34 PM\" src=\"https://github.com/mtgleeson/tiatesting/assets/1771850/d04b527c-f88d-452a-ab20-2d864d7a4424\"\u003e\u003c/kbd\u003e\n\n**Maven, Junit5 and Git**\n```\nmvn tia-junit5-git:html-report\n```\n\n**Maven, Junit5 and Perforce**\n```\nmvn tia-junit5-perforce:html-report\n```\n\n**Maven, Junit4 and Git**\n```\nmvn tia-junit4-git:html-report\n```\n\n**Maven, Junit4 and Perforce**\n```\nmvn tia-junit4-perforce:html-report\n```\n\n**Gradle, Spock and Git**\n```\ngradle tia-html-report\n```\n\n### Text Report\nGenerate a basic text report showing the current information about the Tia DB, the test suites and the source code.\n\n**Maven, Junit5 and Git**\n```\nmvn tia-junit5-git:html-report\n```\n\n**Maven, Junit5 and Perforce**\n```\nmvn tia-junit5-perforce:html-report\n```\n\n**Maven, Junit4 and Git**\n```\nmvn tia-junit4-git:text-report\n```\n\n**Maven, Junit4 and Perforce**\n```\nmvn tia-junit4-perforce:text-report\n```\n\n**Gradle, Spock and Git**\n```\ngradle tia-text-report\n```\n\n## Configuration Options\n\n|Maven|Gradle|Possible Values|Description|Default Value|Mandatory|\n|-----|------|---------------|-----------|-------------|---------|\n|tiaEnabled|enabled|true, false|When true Tia will be used in the test runner and only the selected tests will be run. When disabled, tests are run as normal and no mapping or stats will be updated in the Tia DB.|false|true|\n|tiaUpdateDBMapping|updateDBMapping|true, false|When true, Tia will analyse all changes from the VCS since the last stored commit number in the DB, up to the head commit of the workspace. Only tests impacted by the detected changes will be run. The stored mapping in the Tia DB will be updated at the end of the test run (regardless if the test run was successful or failed).|false|false|\n|tiaCheckLocalChanges|checkLocalChanges|true, false|When true, Tia will analyse all the changes in the local workspace and only run the tests impacted by the local changes. **Note:** when updateDBMapping is true, checkLocalChanges will be disabled regardless of it's value. This is done to ensure the Tia DB is only updated based on analysed changes from VCS and not local changes.|false|false|\n|tiaUpdateDBStats|updateDBStats|true, false|When true, Tia will update the statistics for the test run and individual test suites that were executed in the run.|false|false|\n|tiaProjectDir|projectDir|\u003cstring\u003e|The file path to the root folder of the project being analysed.||true|\n|tiaClassFilesDirs|classFilesDirs|\u003cstring\u003e|Comma seperated list of paths to the folders containing the classes of the source code (not the test source code). Required for Jacoco to analyse the test coverage.||true|\n|tiaSourceFilesDirs|sourceFilesDirs|\u003cstring\u003e|Comma seperated list of paths to the folders containing the source code of the project being analysed.||true|\n|tiaSourceLibs|sourceLibs|\u003cstring\u003e|Comma separated list of `groupId:artifactId:projectDir` entries for in-repo libraries to additionally track coverage for. The `projectDir` segment is the absolute path to the library's own project root (used for loading its build file and for matching VCS diffs against the library's source tree). The `groupId:artifactId` portion is used to resolve the library version from the source project's dependencies and to add the corresponding JAR to Jacoco analysis. When the test and source projects are separate, they must use the same build system.||false|\n|tiaSourceProjectDir|sourceProjectDir|\u003cstring\u003e|The file path to the root of the source project whose resolved dependencies are used to resolve `sourceLibs` to JAR files. Only needed when the project running the tests is different from the source project being tracked. For Gradle this can be the current project, a sibling subproject, or an external Gradle build.|current project|false|\n|tiaTestFilesDirs|testFilesDirs|\u003cstring\u003e|Comma seperated list of paths to the folders containing the source code of the test files for the project being analysed.||true|\n|tiaDBFilePath|dbFilePath|\u003cstring\u003e|The file path for the saved DB containing the previous analysis of the project.||true|\n|tiaBuildDir|N/A|\u003cstring\u003e|The build path for the project. Used for saving files used internally by Tia. Currently only used for Maven.|${project.build.directory}/tia|true|\n|tiaVcsServerUri|N/A|\u003cstring\u003e|Specifies the server URI of the VCS system. Only currently used for Perforce.|For Perforce it will default to use the value in the 'p4 set' command.|false|\n|tiaVcsUserName|N/A|\u003cstring\u003e|Specifies the username for connecting to the VCS system. Only currently used for Perforce.|For Perforce it will default to use the value in the 'p4 set' command.|false|\n|tiaVcsPassword|N/A|\u003cstring\u003e|Specifies the password for connecting to the VCS system. Only currently used for Perforce.|For Perforce it will default to use the locally cached p4 ticket in the users home directory.|false|\n|tiaVcsClientName|N/A|\u003cstring\u003e|Specifies the client name used when connecting to the VCS system. Only currently used for Perforce.|For Perforce it will default to use the value in the 'p4 set' command.|false|\n\n## What is Tia\nTia ia a free test impact analysis library. It analyses changes made to source code and automatically selects the tests to run for your test runner. It's designed as a developer productivity tool to increase the efficiency of developers by cutting down the time required to get feedback on changes. \n\nTia has been designed to be unintrusive in your day-to-day work flow. Once it's setup and configured, it will automatically hook into your build automation tool test system to select the tests, and then update the mapping and record the statsics at the completion of the test run.\n\nThrough the tracking of statistics, Tia can generate reports that show how successful each test suite is, and how long it takes to run. This information can be useful in tracking poorly written or problematic tests that need attention to improve the overall health of the test suites and your builds.\n\n## How Does Tia Work\nTia collects and stores a mapping of methods that are executed for each of your test suites. \n\nTia uses Jacoco to collect the source code coverage for each test suite and store it in the DB for mapping. Tia uses an embedded H2 DB for the data store.\n\nThe first time Tia runs it needs to 'seed' the mapping DB by running all test suites and collecting the source code mapping for each test suite. It will also store the VCS commit value for that version of the test suite and source code mapping. Each subsequent test run then analyses the changes made and selects only the tests to run that are impacted by the source code changes. All other tests are ignored.\n\nTypically you will want a 'primary' automated build that is configured to run Tia on each commit/submit/check-in. Only this build should be configured to update the test suite to source code mapping in the DB (tiaUpdateDBMapping=true).\nDevelopers using Tia on their local workspace should configure Tia to analyse local changes only (tiaUpdateDBMapping=false and tiaCheckLocalChanges=true).\n\n**Note:** The build machine(s) that are designated to be the 'primary' (which update the test suite to source code mapping) need to run the tests suites **sequentially**. This is important to allow Tia to correctly associate the source code coverage with each test suite.  \n\n## Supported Build Automation Tools, VCS and Test Runners\n### Maven 3\n\n| |Git|Perforce|\n|-|---|--------|\n|Junit 4|✔|✔|\n|Junit 5|✔|✔|\n|Spock 2|x|x|\n\n### Gradle\n\n| |Git|Perforce|\n|-|---|--------|\n|Junit 4|x|x|\n|Junit 5|x|x|\n|Spock 2|✔|x|\n\n## Credits\nA shout out to the following libraries that Tia uses:\n - [Jacoco](https://www.eclemma.org/jacoco/)\n - [H2 Database](https://www.h2database.com/)\n - [J2HTML](https://j2html.com/)\n - [ByteBuddy](https://bytebuddy.net/)\n - [JGit](https://github.com/eclipse-jgit/jgit)\n - [P4Java](https://github.com/perforce/p4java)\n - [Java Diff Utils](https://github.com/java-diff-utils/java-diff-utils)\n - [Simple-Datatables](https://fiduswriter.github.io/simple-datatables/)\n - [Pico CSS](https://picocss.com/)\n\n## Additional resources and solutions\n - [https://martinfowler.com/articles/rise-test-impact-analysis.html](https://martinfowler.com/articles/rise-test-impact-analysis.html)\n - [https://gradle.com/gradle-enterprise-solutions/predictive-test-selection/](https://gradle.com/gradle-enterprise-solutions/predictive-test-selection/)\n - [https://research.facebook.com/publications/predictive-test-selection/](https://research.facebook.com/publications/predictive-test-selection/)\n - [https://schibsted.com/blog/impact-testing-stop-waiting-tests-not-need-run/](https://schibsted.com/blog/impact-testing-stop-waiting-tests-not-need-run/)\n - [https://github.com/rpau/junit4git](https://github.com/rpau/junit4git)\n - [https://www.parasoft.com/products/parasoft-jtest/java-test-impact-analysis/](https://www.parasoft.com/products/parasoft-jtest/java-test-impact-analysis/)\n - [https://www.sealights.io/product/test-impact-analysis/#](https://www.sealights.io/product/test-impact-analysis/#) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtgleeson%2Ftiatesting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtgleeson%2Ftiatesting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtgleeson%2Ftiatesting/lists"}