|
This page relates to Record test results with CloudBees Smart Tests. |
The Test Session is one of CloudBees Smart Tests’s core concepts. When you record test results, those results are recorded to a test session. When you request a subset of tests from CloudBees Smart Tests, the subset is linked to a test session, too. This concept is useful because tests might run several times against the same build; it helps disambiguate those runs.
Normally, the CloudBees Smart Tests CLI manages session creation and usage in the background. However, if your build and test processes are split across multiple machines, or if your tests are parallelized across multiple machines, you will need to create test sessions yourself.
Build and test processes happen on different machines
Normally, the CloudBees Smart Tests CLI handles creating, saving, and retrieving a session ID in the background. When you run smart-tests subset or smart-tests record tests, the CLI checks for an existing file in ~/.launchable. This file is written when you run smart-tests record build.
However, if you need to record tests (smart-tests record tests) or request a subset (smart-tests subset) on a different machine than the one where smart-tests record build ran, the ~/.launchable file won’t be present. You will need to manually create a test session using the smart-tests record session command at the beginning of your test.
This command outputs a string that you can store and then pass into the --session option in smart-tests subset and smart-tests record tests.
Here is an example:
Combine test reports from multiple runs
Some pipelines execute multiple test runs against a build, outputting distinct test report(s) across several machines. Depending on your layout, you may want to combine these into a single test session. For more information, refer to Test Session.
|
This may also be the case if you execute tests of a single type across several parallel runs, but usually the test runner can combine reports from parallel runs for consumption from a single place. If all the test reports for a session can be collected from a single machine, you don’t need to use this method. |
Tie multiple smart-tests record tests invocations to a single test session:
-
Use the
smart-tests record sessioncommand to create a session ID -
Pass this ID into the corresponding
--sessionparameter insmart-tests record tests(note: pseudocode) :
For more information, refer to smart-tests record session in the CLI reference.