Data examples

3 minute read

This page provides examples of the various data the CloudBees Smart Tests CLI sends to the CloudBees Smart Tests service.

You can use the --dry-run global option to preview what data would be passed in a real request. You can also use the --log-level audit global option when you invoke the CLI to view exactly what data was passed in the request. See the CLI reference for more info about both of these options.

Recording commits

e.g. smart-tests record commit

POST body sent to the Launchable API:

{ "commits" : [ { "commitHash" : "d7159e2418dae84cb36d3de50cc792eb952c7df5", "authorEmailAddress" : "994a70d1ac542e847f24abfcbe05e68926c281c81cd13c704964800d58d022e3", "authorWhen" : 1763503839000, "authorTimezoneOffset" : -480, "committerEmailAddress" : "3c205d8fc749f72977b9331e3179773c315bb1f4860c366de2abe9ec9337730b", "committerWhen" : 1763503839000, "committerTimezoneOffset" : -480, "message" : "", "shallow" : false, "parentHashes" : { "55f48c3a472ca1a17e69180e9733f288f4e1d84e" : [ ], "6ba6000a7c61788be8fa263bdd95b4818ff6b3f9" : [ { "linesAdded" : 164, "linesDeleted" : 164, "status" : "ADD", "path" : "/dev/null", "pathTo" : "smart_tests/test_runners/jasmine.py" }, { "linesAdded" : 159, "linesDeleted" : 159, "status" : "ADD", "path" : "/dev/null", "pathTo" : "tests/data/jasmine/jasmine-test-results.json" }, { "linesAdded" : 81, "linesDeleted" : 81, "status" : "ADD", "path" : "/dev/null", "pathTo" : "tests/data/jasmine/record_test_result.json" }, { "linesAdded" : 16, "linesDeleted" : 16, "status" : "ADD", "path" : "/dev/null", "pathTo" : "tests/data/jasmine/subset_payload.json" }, { "linesAdded" : 27, "linesDeleted" : 27, "status" : "ADD", "path" : "/dev/null", "pathTo" : "tests/test_runners/test_jasmine.py" } ] } } ] { "tree": [ { "blob": "761b6995de8fa459197c26a17afe6829203e5aa9", "path": "smart_tests/args4p/option.py" }, { "blob": "25d94e464ed17da4069f93c5568f7ac4f9daac7d", "path": "smart_tests/args4p/parameter.py" }, ... { "blob": "4a4903634a495f2309e6ab8d999ce1aa1b154f0c", "path": "tests/utils/test_git_log_parser.py" }, { "blob": "1f5c4229abfaaed01f4340df0af9c6fd4e87edae", "path": "tests/utils/test_glob.py" } ] }

Recording builds

e.g. smart-tests record session --build example-build

POST body sent to the CloudBees Smart Tests API:

{ "buildNumber": "example-build", "lineage": "main", "commitHashes": [ { "repositoryName": ".", "commitHash": "394e9af90cd130409f4c2fa48456d8d790149149", "branchName": "main" } ], "links": [], "timestamp": null }

Recording sessions

e.g. smart-tests record session --build <BUILD NAME> --test-suite=unut-test --flavor os=ubuntu=latest

POST body sent to the CloudBees Smart Tests API:

{ "flavors": { "os": "ubuntu-latest" }, "isObservation": false, "noBuild": false, "testSuite": "unit-test", "timestamp": null, "links": [] }

Subsetting tests

e.g. find ./tests/**/*_test.py | smart-tests subset --session $(cat session.txt) file > subset.txt

POST body sent to the CloudBees Smart Tests API:

{ "testPaths": [ [ { "type": "file", "name": "tests/__init__.py" } ], [ { "type": "file", "name": "tests/args4p/__init__.py" } ] ... ], "testRunner": "file", "session": { "id": "411" }, "ignoreNewTests": false, "getTestsFromPreviousSessions": false, "getTestsFromGuess": false, "useServerSideOptimizationTarget": true, "changesUnderTest": "one-commit" }

Recording test results

e.g. `smart-tests reocrd tests --session $(cat session.txt) file test-results/*.xml `

POST body sent to the CloudBees Smart Tests API:

{ "events": [ { "type": "case", "testPath": [ { "type": "file", "name": "tests/commands/compare/test_subsets.py" }, { "type": "testsuite", "name": "tests.commands.compare.test_subsets.SubsetsTest" }, { "type": "testcase", "name": "test_subsets" } ], "duration": 0.011, "status": 1, "stdout": "", "stderr": "", "createdAt": "2025-10-22T15:58:36+09:00", "data": { "lineNumber": 9 } }, { "type": "case", "testPath": [ { "type": "file", "name": "tests/commands/compare/test_subsets.py" }, { "type": "testsuite", "name": "tests.commands.compare.test_subsets.SubsetsTest" }, { "type": "testcase", "name": "test_subsets_when_deleted_tests" } ], "duration": 0.01, "status": 1, "stdout": "", "stderr": "", "createdAt": "2025-10-22T15:58:36+09:00", "data": { "lineNumber": 103 } }, { "type": "case", "testPath": [ { "type": "file", "name": "tests/commands/compare/test_subsets.py" }, { "type": "testsuite", "name": "tests.commands.compare.test_subsets.SubsetsTest" }, { "type": "testcase", "name": "test_subsets_when_new_tests" } ], "duration": 0.01, "status": 1, "stdout": "", "stderr": "", "createdAt": "2025-10-22T15:58:36+09:00", "data": { "lineNumber": 55 } }, { "type": "case", "testPath": [ { "type": "file", "name": "tests/commands/record/test_attachment.py" }, { "type": "testsuite", "name": "tests.commands.record.test_attachment.AttachmentTest" }, { "type": "testcase", "name": "test_attachment" } ], "duration": 0.041, "status": 1, "stdout": "", "stderr": "", "createdAt": "2025-10-22T15:58:36+09:00", "data": { "lineNumber": 13 } }, { "type": "case", "testPath": [ { "type": "file", "name": "tests/commands/record/test_build.py" }, { "type": "testsuite", "name": "tests.commands.record.test_build.BuildTest" }, { "type": "testcase", "name": "test_build_name_validation" } ], "duration": 0.019, "status": 1, "stdout": "", "stderr": "", "createdAt": "2025-10-22T15:59:01+09:00", "data": { "lineNumber": 302 } }, ... ], "testRunner": "file", "group": "", "metadata": {}, "noBuild": false, "testSuite": "", "flavors": {} }