Background
Each Test Session is associated with a Build.
In particular, Predictive Test Selection selects tests based on the Git changes in a build (among other data).
Recording builds
To record a build, run smart-tests record build before you create a build in your CI script:
smart-tests record build --build <BUILD NAME> --source src=<PATH TO SOURCE> --branch <BRANCH NAME>
-
With the
--buildoption, you assign a unique identifier to this build. You will use this value later when you record test results. See Choosing a value for build name for tips on choosing this value. -
The
--sourceoption points to the local copy of the Git repository (or repositories) used to produce this build, such as.orsrc. * Make sure to point to a full clone of each repository, not a partial clone. * GitHub Actions users: if you useactions/checkoutto check out the current repo, setfetch-depth: 0.
You can view your recorded builds on the Builds page of the CloudBees Smart Tests dashboard.
Recording test results against your builds
After you record a build, you can record test results against it by updating the smart-tests record tests invocation(s) you created after following Recording test results with the CloudBees Smart Tests CLI:
# before smart-tests record tests --no-build <TOOL> <PATH TO REPORTS> # after smart-tests record tests --build <BUILD NAME> --session <SESSION_NAME> <TOOL> <PATH TO REPORTS>
If done correctly, you’ll see the corresponding build name for each test session on the Test Sessions page.