Apex Tests

Manage apex tests in a package or a org

sfp apextests trigger

Triggers Apex unit test in an org. Supports test level RunAllTestsInPackage, which optionally allows validation of individual class code coverage

USAGE
  $ sfp apextests trigger -o <value> [--json] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [--apiversion <value>] [-l
    RunSpecifiedTests|RunApexTestSuite|RunLocalTests|RunAllTestsInOrg|RunAllTestsInPackage|RunAllTestsInDomain] [-n
    <value>...] [-r <value>] [-c] [--validatepackagecoverage] [--specifiedtests <value>] [--apextestsuite <value>] [-p
    <value>] [-w <value>] [--commitsha <value>] [-r <value>] [--outputformat raw|dashboard|both] [--environment <value>]

FLAGS
  -c, --validateindividualclasscoverage  Validate that individual classes have a coverage greater than the minimum
                                         required percentage coverage, only available when test level is
                                         RunAllTestsInPackage
  -l, --testlevel=<option>               [default: RunLocalTests] The test level of the test that need to be executed
                                         when the code is to be deployed
                                         <options: RunSpecifiedTests|RunApexTestSuite|RunLocalTests|RunAllTestsInOrg|Run
                                         AllTestsInPackage|RunAllTestsInDomain>
  -n, --package=<value>...               Name of the package to run tests. Required when test level is
                                         RunAllTestsInPackage
  -o, --targetusername=<value>           (required) Username or alias of the target org.
  -p, --coveragepercent=<value>          [default: 75] Minimum required percentage coverage, when validating code
                                         coverage
  -r, --releaseconfig=<value>            Path to the release config file(s) to test all packages within the domain
  -r, --repourl=<value>                  Custom source repository URL to use in artifact metadata, overrides origin URL
                                         defined in git config
  -w, --waittime=<value>                 Wait time in minutes for command to finish. Use 0 or omit for indefinite wait
      --apextestsuite=<value>            comma-separated list of Apex test suite names to run
      --apiversion=<value>               Override the api version used for api requests made by this command
      --commitsha=<value>                Commit SHA to use while reporting test results in markdown format
      --environment=<value>              Environment name for dashboard format (defaults to target org alias)
      --loglevel=<option>                [default: info] logging level for this command invocation
                                         <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --outputformat=<option>            [default: raw] Output format for test results
                                         <options: raw|dashboard|both>
      --specifiedtests=<value>           comma-separated list of Apex test class names or IDs and, if applicable, test
                                         methods to run
      --validatepackagecoverage          Validate that the package coverage is greater than the minimum required
                                         percentage coverage, only available when test level is RunAllTestsInPackage

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Triggers Apex unit test in an org. Supports test level RunAllTestsInPackage, which optionally allows validation of
  individual class code coverage

EXAMPLES
  $ sfp apextests:trigger -o scratchorg -l RunLocalTests -s

  $ sfp apextests:trigger -o scratchorg -l RunAllTestsInPackage -n <mypackage> -c

See code: src/commands/apextests/trigger.tsarrow-up-right

Last updated

Was this helpful?