Subset with the CloudBees Smart Tests CLI

2 minute read

Use smart-tests subset to request a subset of tests from CloudBees Smart Tests. Run this command before your standard test runner command to generate a list of tests that you can pass into your test runner to run.

To test out subset behavior before running in production, refer to Observe subset behavior. For an alternative subsetting interface that is useful in some scenarios, refer to Zero Input Subsetting.

Options

The smart-tests subset command takes various options:

  • high-level options

  • test runner

  • test runner options

smart-tests subset <HIGH LEVEL OPTIONS> <TEST RUNNER> <TEST RUNNER OPTIONS>

<TEST RUNNER> is always a string representing the test runner in use (for example, maven and ant).

The examples below do not include all high-level options, so read this section and the Subset section of the CLI reference before continuing. Test runner options are listed in each section.

Required options

Optimization target

At a minimum, an optimization target option must be specified, by either:

  • --confidence

  • --time

  • --target

For more information, refer to Choose a subset optimization target.

Build or session identifier

The examples below include the high-level --build <BUILD NAME> option, used for specifying the build for which to request test recommendations. This is the same build that you already created to record tests. The subset command goes in between these.

Before subsetting (simplified)

# build process smart-tests record build --build $BUILD_NAME <OPTIONS> <build process> # test process smart-tests record session --build $BUILD_NAME --session $SESSION_NAME <OPTIONS> <test process> smart-tests record tests --session $SESSION_NAME <OPTIONS>

After subsetting (simplified)

# build process smart-tests record build --build $BUILD_NAME <OPTIONS> <build process> # test process smart-tests record session --build $BUILD_NAME --session $SESSION_NAME <OPTIONS> smart-tests subset --session $SESSION_NAME <OPTIONS> # and related commands <test process> smart-tests record tests --session $SESSION_NAME <OPTIONS>

To generate a test session manually use --session instead of --build. For more information, refer to Manage complex test session layouts.

Instructions for test runners/build tools

The CloudBees Smart Tests CLI supports many popular test runners and build tools. Follow the instructions for the tool used for subsetting.

Table 1. System-specific test runners/build tools

Android Compatibility Test Suite (CTS)

Android Debug Bridge (ADB)

Ant

Bazel

Behave

CTest

cucumber

dotnet test

Flutter

GoogleTest

Go Test

Gradle

Jest

Karma

Maven

minitest

NUnit console runner

Prove for perl

Playwright

pytest

Robot

RSpec

Ruby test unit

TestNG

Vitest

XCTest

Other instructions

If not using one of the test runners above, CloudBees Smart Tests also uses the following options:

Troubleshoot integration issues

Coming soon!