{"id":19696031,"url":"https://github.com/delsner/tinytp","last_synced_at":"2025-08-07T20:21:33.673Z","repository":{"id":152714398,"uuid":"621792264","full_name":"delsner/tinytp","owner":"delsner","description":"TinyTP is a tiny tool for test prioritization","archived":false,"fork":false,"pushed_at":"2023-05-15T20:38:32.000Z","size":2536,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-10T09:39:54.743Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","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/delsner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-31T11:54:48.000Z","updated_at":"2023-04-06T13:07:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"8a35059d-c092-4134-ab67-e1b6f95e6e79","html_url":"https://github.com/delsner/tinytp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delsner%2Ftinytp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delsner%2Ftinytp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delsner%2Ftinytp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delsner%2Ftinytp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/delsner","download_url":"https://codeload.github.com/delsner/tinytp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241007660,"owners_count":19893039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T19:33:10.736Z","updated_at":"2025-02-27T11:36:56.414Z","avatar_url":"https://github.com/delsner.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TinyTP\n\n![CI](https://github.com/delsner/tinytp/actions/workflows/build.yml/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/delsner/tinytp/badge.svg)](https://coveralls.io/github/delsner/tinytp)\n\n\nTinyTP is a tiny program for test prioritization.\n\n## Structure\n\nThe project has the following structure:\n\n```\n├── cmake           \u003c- Internal cmake configuration files.\n├── external        \u003c- Third-party libraries.\n├── include         \u003c- TinyTP headers.\n├── test            \u003c- Unit tests.\n└── tinytp          \u003c- TinyTP sources. \n```\n\n## Usage\n\n```shell\n$ tinytp --help\ntinytp: help\n\nUsage: tinytp [OPTIONS] COMMAND\n\nA simple test prioritization tool.\n\nOptions:\n\t--db string \t\tPath to TinyTP database (default: tinytp.db)\n\t--output string\t\tDirectory where to put any output (except database) (default: current)\n\t--changes string\tPath to file containing files in changeset (default: changeset.txt)\n\t--jenkins string\tPath to Jenkins JSON report (default: test-report.json)\n\t--module\t\tPrioritize at test module level\n\nCommands:\n\tcollect\t\tCollect data and store into TinyTP database\n\tprio\t\tPrioritize tests\n```\n\n## Example\n\nTinyTP provides a simple command line program that has two commands, `tinytp collect` and `tinytp prio`.\nThese can be used to either (1) collect new test results and store them into the TinyTP database or (2) run a test\nprioritization algorithm.\n\n### Collecting and Storing Test Results\n\nThere might be different test report parsers in the future. As of now, TinyTP supports only the Jenkins JSON test report format.\nFor the sake of this example, we're going to create a dummy report first:\n```shell\n# Create sample Jenkins JSON test report\n$ echo '{\n    \"suites\": [\n        {\n            \"name\": \"foo.bar.Suite1\",\n            \"duration\": 0.08,\n            \"cases\": [\n                {\n                    \"name\": \"Case1\",\n                    \"duration\": 0.01,\n                    \"status\": \"FAILED\"\n                },\n                {\n                    \"name\": \"Case2\",\n                    \"duration\": 0.07,\n                    \"status\": \"PASSED\"\n                }\n            ]\n        },\n        {\n            \"name\": \"foo.bar.Suite2\",\n            \"duration\": 0.1,\n            \"cases\": [\n                {\n                    \"name\": \"Case1\",\n                    \"duration\": 0.05,\n                    \"status\": \"FAILED\"\n                },\n                {\n                    \"name\": \"Case2\",\n                    \"duration\": 0.05,\n                    \"status\": \"FAILED\"\n                }\n            ]\n        }\n    ]\n}' \u003e test-report.json\n```\n\nNow we can run the `tinytp collect` command and store it into the database (default is `tinytp.db`):\n\n```shell\n$ tinytp collect --jenkins test-report.json --db tp.db\n```\n\nTo check if the database content is correct, you can run the following command:\n```shell\n$ sqlite3 tp.db \"select * from test_suite_execution;\"\n1|foo.bar.Suite1|foo.bar|1|2|1680716088707|0.08\n2|foo.bar.Suite2|foo.bar|2|2|1680716088708|0.1\n```\n\n### Running the Prioritization\n\nTo run the prioritization, you can specify the algorithm as well as the granularity (i.e., test suite or module level):\n\n```shell\n$ tinytp prio --db tp.db [--module]\n# Check created output file \"tintytp.prio\"\n$ cat tinytp.prio\nfoo.bar.Suite2,0.666667\nfoo.bar.Suite1,0.416667\n```\n\nTo also incorporate the changeset (e.g., in a pull request), pass the `--changes` option:\n\n```shell\n$ git diff --name-only HEAD^1 \u003e changeset.txt\n$ tinytp prio --db tp.db --changes changeset.txt\n```\n\n## Build\n\n### CMake\n\nRun the following commands in the root of the TinyTP repository to build all subprojects:\n\n```shell\nmkdir build\ncd build\n# (1) Generate build system using cmake\n# Linux/Windows\ncmake -DCMAKE_BUILD_TYPE=Debug ..\n# [optional] Change generator and target arch on Windows\ncmake -DCMAKE_BUILD_TYPE=Debug -G \"Visual Studio 17 2022\" -A x64 ..\n# (2) Build TinyTP using generated build system (Win32: MSBuild, Linux/macOS: Unix Makefiles)\ncmake --build . --config Debug\n```\n\n### Docker\n\nThere is a [`Dockerfile`](./Dockerfile) for dockerized builds.\nFor building the Docker image and creating a container with a new `bash` session, run:\n\n```shell\n# Build TinyTP docker image \n$ docker build -t tinytp:0.1 -f Dockerfile .\n# Create and run container with new bash session and current working directory mounted into container\n$ docker run -v $(pwd):/tinytp -it tinytp:0.1 bash\n```\n\nThen, you can run the `cmake` commands from above inside the `bash` session to build TinyTP.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelsner%2Ftinytp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdelsner%2Ftinytp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelsner%2Ftinytp/lists"}