Run Apex tests in a given Environment. Test results can optionally be exported in a format that a CI/CD tool can use to publish the results.
The name of the stack to target. Stack names are case-insensitive. Stacks are specific to license keys, and you can see a list of all available stacks with the stack:list command.
This value is required if no valid default stack has been set, or if you would like to target a stack other than the one that is currently the default stack. You can use the stack:setdefault command to set or change the default stack.
Required. Prompted for if not supplied and able to do so.
The name of the environment to run tests in. Environment names are case-insensitive.
The key used to encrypt or decrypt stored credentials.
- You want the process to utilise previously encrypted credentials, or if you want the process to save credentials
- AND the encryption key has not been saved locally with the auth:key:save command, or the key that has been saved locally is not the key that you wish to use
A comma separated list of test class names to execute. Example:
If specified, only the tests contained within test class names provided will be executed.
A comma separated list of test suite names to execute. Example:
If specified, only the tests contained within test suite names provided will be executed.
If specified, every test will be executed (even those in managed packages). Otherwise, only local tests will be executed.
If specified, the OrgFlow CLI will output the results of the test run to a JUnit format file. This file can be read by many CI/CD tools to report on the results of the test run.
If specified, the OrgFlow CLI will return a zero exit code even if one or more of the executed tests failed. Otherwise, the OrgFlow CLI will return an exit code of
2if any of the executed tests fail.
If specified, Salesforce will stop execution of the test run once the number of failed tests reach the limit specified. This is useful, for example, if you want to fail fast and halt execution as soon as a single test fails.
If specified, code coverage will not be calculated by Salesforce for this test run.
The following options are global across all commands:
If specified, prints help for this command instead of executing it.
The License Key you were issued to allow you to use the OrgFlow CLI. If a valid key is supplied, it is stored locally on the machine so that it does not need to be specified again on the next execution.
If specified, you are signifying that you accept our End User License Agreement (EULA). You only need to specify this once per device, because your acceptance will be cached on the device (you can pass
--acceptEula=falseif you wish to clear this). You must accept our EULA to be able to run most OrgFlow commands.
If specified, a log file is written to the specified path. The specified path may contain one or more tokens; see Logging for more information.
The minimum log level to be written to the log file; logs below this level will not be written. Only effective if a valid value for
--logTohas been specified.
If the CLI encounters an exception then it will ask (where possible) the user whether or not to create a Diagnostic Bundle and write it to disk. If it is not able to prompt then no action is taken. This is the default behaviour (
You can change this default behaviour (and suppress the prompt) by specifying either
Never(which will always write the bundle or never write the bundle, respectively). This is particularly useful in a CI/CD context, where the CLI may not be able to prompt, but you still want to create diagnostic bundles for all failures.
If specified, sets the location to write the Diagnostic Bundle (if any). If not specified, a default location will automatically be chosen. This default location depends on a number of factors, including the operating system and some file-system based restrictions that might be in place. The location that the diagnostic bundle is ultimately written to is always included in the standard error output of the CLI.
If specified, suppresses confirmation prompts that the CLI might raise before performing destructive or dangerous procedures. If suppressed, the CLI assumes that the prompts would have been answered positively and continues with execution.
Controls how progress is printed to the standard error stream:
Interactive: Progress is sent to the standard error stream only if the standard error stream is connected to an interactive terminal.
Never: Progress is not sent to the standard error stream.
Always: Progress is sent to the standard error stream, even if that stream has been redirected.
If specified, sets the location to use as storage for files that may need to be stored on disk temporarily during command execution. For example, the location on disk where zip files containing metadata from Salesforce are downloaded to before they are unzipped.
If not specified, the CLI will automatically choose an appropriate location on disk (usually in the current user's temporary storage location). This automatically chosen location may be deeply nested within a drive, which may be problematic if the operating system imposes limits on file path lengths and the files placed into temporary storage have particularly long paths or names.
Switches the format of the output sent to the standard output stream to JSON. This is the most verbose output available, and is useful for scripting or automation.
If specified, the CLI will ignore any cached Salesforce access tokens, and will require the Salesforce authentication process to be re-completed for each organisation that the command connects to.
If no value is specified, the CLI will indefinitely retry any process that fails due to a transient error. This is the default behaviour, and allows for resilience against temporary issues that might otherwise cause a process to fail.
Specify a positive integer value to prevent indefinite retries. Each process that fails due to a transient error will be retried up to a maximum amount of times specified. For example,
--maxTransientErrorRetries=5: Each process that fails will be re-tried up to a maximum of five times. If an earlier process fails four times but then succeeds on the fifth attempt, the counter is reset for the next process.
--maxTransientErrorRetries=0to disable transient failure retries.
Processes retried due to a transient error are delayed by a back-off policy that gradually increases the time to wait between retries. Specify a non-negative integer value as the maximum amount of seconds to wait between attempts.
--maxTransientErrorDelay=0to disable the back-off policy and always instantly retry failed processes.
Run every local test in an environment called
orgflow env:test --environment=production
Run every test (including those in managed packages) in an environment called
orgflow env:test --environment=production --runAllTests
Run test from two test classes in an environment called
Production, export the results to a JUnit format file, and halt the test execution if 5 or more tests fail:
orgflow env:test --classes=TestClassA,TestClassB --environment=production --jUnitTo="/TestResults/TestExecution1.xml" --failureLimit=5