@@ -94,6 +94,7 @@ Happy debugging!
9494- [ ` sf apex run test ` ] ( #sf-apex-run-test )
9595- [ ` sf apex tail log ` ] ( #sf-apex-tail-log )
9696- [ ` sf logic get test ` ] ( #sf-logic-get-test )
97+ - [ ` sf logic run test ` ] ( #sf-logic-run-test )
9798
9899## ` sf apex get log `
99100
@@ -149,7 +150,7 @@ FLAG DESCRIPTIONS
149150 directory.
150151```
151152
152- _ See code: [ src/commands/apex/get/log.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.7.1 /src/commands/apex/get/log.ts ) _
153+ _ See code: [ src/commands/apex/get/log.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.8.0 /src/commands/apex/get/log.ts ) _
153154
154155## ` sf apex get test `
155156
@@ -209,7 +210,7 @@ EXAMPLES
209210 me@myorg'
210211```
211212
212- _ See code: [ src/commands/apex/get/test.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.7.1 /src/commands/apex/get/test.ts ) _
213+ _ See code: [ src/commands/apex/get/test.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.8.0 /src/commands/apex/get/test.ts ) _
213214
214215## ` sf apex list log `
215216
@@ -249,7 +250,7 @@ EXAMPLES
249250 $ sf apex list log --target-org [email protected] 250251```
251252
252- _ See code: [ src/commands/apex/list/log.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.7.1 /src/commands/apex/list/log.ts ) _
253+ _ See code: [ src/commands/apex/list/log.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.8.0 /src/commands/apex/list/log.ts ) _
253254
254255## ` sf apex run `
255256
@@ -296,7 +297,7 @@ EXAMPLES
296297 $ sf apex run
297298```
298299
299- _ See code: [ src/commands/apex/run.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.7.1 /src/commands/apex/run.ts ) _
300+ _ See code: [ src/commands/apex/run.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.8.0 /src/commands/apex/run.ts ) _
300301
301302## ` sf apex run test `
302303
@@ -348,6 +349,9 @@ DESCRIPTION
348349 haven't finished by the end of the wait time, the command displays a test run ID. Use the "sf apex get test
349350 --test-run-id" command to get the results.
350351
352+ To run both Apex and Flow tests together, run the "sf logic run test" CLI command, which has similar flags as this
353+ command, but expands the --tests flag to also include Flow tests.
354+
351355 You must have the "View All Data" system permission to use this command. The permission is disabled by default and can
352356 be enabled only by a system administrator.
353357
@@ -439,7 +443,7 @@ FLAG DESCRIPTIONS
439443 --tests Test1 --tests Test2
440444```
441445
442- _ See code: [ src/commands/apex/run/test.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.7.1 /src/commands/apex/run/test.ts ) _
446+ _ See code: [ src/commands/apex/run/test.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.8.0 /src/commands/apex/run/test.ts ) _
443447
444448## ` sf apex tail log `
445449
@@ -482,7 +486,7 @@ EXAMPLES
482486 $ sf apex tail log --color --skip-trace-flag
483487```
484488
485- _ See code: [ src/commands/apex/tail/log.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.7.1 /src/commands/apex/tail/log.ts ) _
489+ _ See code: [ src/commands/apex/tail/log.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.8.0 /src/commands/apex/tail/log.ts ) _
486490
487491## ` sf logic get test `
488492
@@ -530,6 +534,122 @@ EXAMPLES
530534 $ sf logic get test --test-run-id <test run id> --result-format junit --target-org my-scratch
531535```
532536
533- _ See code: [ src/commands/logic/get/test.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.7.1/src/commands/logic/get/test.ts ) _
537+ _ See code: [ src/commands/logic/get/test.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.8.0/src/commands/logic/get/test.ts ) _
538+
539+ ## ` sf logic run test `
540+
541+ Invoke tests for Apex and Flows in an org.
542+
543+ ```
544+ USAGE
545+ $ sf logic run test -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-d <value>] [-l
546+ RunLocalTests|RunAllTestsInOrg|RunSpecifiedTests] [-n <value>... | -s <value>... | -t <value>... | --test-category
547+ Apex|Flow...] [-r human|tap|junit|json] [-w <value>] [-y] [-v -c] [--concise]
548+
549+ FLAGS
550+ -c, --code-coverage Retrieve code coverage results.
551+ -d, --output-dir=<value> Directory in which to store test run files.
552+ -l, --test-level=<option> Level of tests to run; default is RunLocalTests.
553+ <options: RunLocalTests|RunAllTestsInOrg|RunSpecifiedTests>
554+ -n, --class-names=<value>... Apex test class names to run; default is all classes.
555+ -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
556+ configuration variable is already set.
557+ -r, --result-format=<option> [default: human] Format of the test results.
558+ <options: human|tap|junit|json>
559+ -s, --suite-names=<value>... Apex test suite names to run.
560+ -t, --tests=<value>... Comma-separated list of test names to run. Can include Apex test classes and Flow
561+ tests.
562+ -v, --detailed-coverage Display detailed code coverage per test.
563+ -w, --wait=<value> Sets the streaming client socket timeout in minutes; specify a longer wait time if
564+ timeouts occur frequently.
565+ -y, --synchronous Runs test methods from a single Apex class synchronously; if not specified, tests are
566+ run asynchronously.
567+ --api-version=<value> Override the api version used for api requests made by this command
568+ --concise Display only failed test results; works with human-readable output only.
569+ --test-category=<option>... Category of tests to run, such as Apex or Flow.
570+ <options: Apex|Flow>
571+
572+ GLOBAL FLAGS
573+ --flags-dir=<value> Import flag values from a directory.
574+ --json Format output as json.
575+
576+ DESCRIPTION
577+ Invoke tests for Apex and Flows in an org.
578+
579+ This command provides a single and unified way to run tests for multiple Salesforce features, such as Apex classes and
580+ Flows. Running the tests together with a single command ensures seamless interoperability between the features.
581+
582+ By default, the command executes asynchronously and returns a test run ID. Then use the "sf logic get test" command to
583+ retrieve the results. If you want to wait for the test run to complete and see the results in the command output, use
584+ the --synchronous flag.
585+
586+ To run specific tests, use the --tests flag, passing it the Apex test class names or the Flow tests in the form
587+ Flowtest.<name>. You can also run specific test methods, although if you run the tests synchronously, the methods must
588+ belong to a single Apex class or Flow test. To run all tests of a certain category, use --test-level with
589+ --test-category. If neither flag is specified, all local tests for all categories are run by default. You can also use
590+ the --class-names and --suite-names flags to run Apex test classes or suites.
591+
592+ To see code coverage results, use the --code-coverage flag with --result-format. The output displays a high-level
593+ summary of the test run and the code coverage values for the tested classes or flows. If you specify human-readable
594+ result format, use the --detailed-coverage flag to see detailed coverage results for each test method run.
595+
596+ You must have the "View All Data" org system permission to use this command. The permission is disabled by default and
597+ can be enabled only by a system administrator.
598+
599+ EXAMPLES
600+ Run a mix of specific Apex and Flow tests asynchronously in your default org:
601+
602+ $ sf logic run test --tests MyApexClassTest,FlowTest.ProcessOrder
603+
604+ Run all local Apex and Flow tests and wait for the results to complete; run the tests in the org with alias
605+ "my-scratch":
606+
607+ $ sf logic run test --test-level RunLocalTests --test-category Apex --test-category Flow --synchronous \
608+ --target-org my-scratch
609+
610+ Run two methods in an Apex test class and an Apex test suite:
611+
612+ $ sf logic run test --class-names MyApexClassTest.methodA --class-names MyApexClassTest.methodB --suite-names \
613+ MySuite
614+
615+ Run all local tests for all categories (the default behavior), save the JUnit results to the "test-results"
616+ directory, and include code coverage results:
617+
618+ $ sf logic run test --result-format junit --output-dir test-results --synchronous --code-coverage
619+
620+ FLAG DESCRIPTIONS
621+ -l, --test-level=RunLocalTests|RunAllTestsInOrg|RunSpecifiedTests Level of tests to run; default is RunLocalTests.
622+
623+ Here's what the levels mean:
624+
625+ - RunSpecifiedTests — Only the tests that you specify in the runTests option are run. Code coverage requirements
626+ differ from the default coverage requirements when using this test level. The executed tests must cover each class
627+ and trigger in the deployment package for a minimum of 75% code coverage. This coverage is computed for each class
628+ and triggers individually, and is different than the overall coverage percentage.
629+ - RunLocalTests — All local tests in your org, including tests that originate from no-namespaced unlocked packages,
630+ are run. The tests that originate from installed managed packages and namespaced unlocked packages aren't run. This
631+ test level is the default for production deployments that include Apex classes or triggers.
632+ - RunAllTestsInOrg — All tests are run. The tests include all tests in your org.
633+
634+ -n, --class-names=<value>... Apex test class names to run; default is all classes.
635+
636+ If you select --class-names, you can't specify --suite-names or --tests.
637+ For multiple classes, repeat the flag for each.
638+ --class-names Class1 --class-names Class2
639+
640+ -s, --suite-names=<value>... Apex test suite names to run.
641+
642+ If you select --suite-names, you can't specify --class-names or --tests.
643+ For multiple suites, repeat the flag for each.
644+ --suite-names Suite1 --suite-names Suite2
645+
646+ -t, --tests=<value>... Comma-separated list of test names to run. Can include Apex test classes and Flow tests.
647+
648+ If you specify --tests, you can't specify --class-names or --suite-names
649+ For multiple tests, repeat the flag for each.
650+ --tests Test1 --tests Test2
651+ ```
652+
653+ _ See code: [ src/commands/logic/run/test.ts] ( https://github.com/salesforcecli/plugin-apex/blob/3.8.0/src/commands/logic/run/test.ts ) _
534654
535655<!-- commandsstop -->
0 commit comments