Skip to content

Commit 8baeeb8

Browse files
Merge branch 'main' into er/addSupportForAgentTests
2 parents de8c7fd + 9eaf879 commit 8baeeb8

File tree

6 files changed

+144
-23
lines changed

6 files changed

+144
-23
lines changed

.eslintrc.cjs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/*
2-
* Copyright (c) 2021, salesforce.com, inc.
3-
* All rights reserved.
4-
* Licensed under the BSD 3-Clause license.
5-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6-
*/
71
module.exports = {
82
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license', 'plugin:sf-plugin/recommended'],
93
};

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# [3.8.0](https://github.com/salesforcecli/plugin-apex/compare/3.7.1...3.8.0) (2025-09-16)
2+
3+
### Bug Fixes
4+
5+
- remove Agent as a valid test-category value ([59e607b](https://github.com/salesforcecli/plugin-apex/commit/59e607b80aa0d13e4019e5d234010b3ded093703))
6+
- remove alias ([93e15e1](https://github.com/salesforcecli/plugin-apex/commit/93e15e1e02c90ad127d21d9d58339d7bbbf51954))
7+
- rename class ([6bf342c](https://github.com/salesforcecli/plugin-apex/commit/6bf342c229ddd42f8fa6c57bc9217f296845d049))
8+
9+
### Features
10+
11+
- add logic run test command ([89ff36b](https://github.com/salesforcecli/plugin-apex/commit/89ff36ba5dcca1a357333b62ba414df0afbdfd74))
12+
113
## [3.7.1](https://github.com/salesforcecli/plugin-apex/compare/3.7.0...3.7.1) (2025-09-14)
214

315
### Bug Fixes

README.md

Lines changed: 127 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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 -->

messages/runlogictest.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ This command provides a single and unified way to run tests for multiple Salesfo
88

99
By default, the command executes asynchronously and returns a test run ID. Then use the "sf logic get test" command to retrieve the results. If you want to wait for the test run to complete and see the results in the command output, use the --synchronous flag.
1010

11-
To run specific tests, use the --tests flag, passing it the Apex test class names or the Flow tests in the form FlowTest.<name> or Agentforce agents tests in the form AgentTest.<name>. You can also run specific test methods, although if you run the tests synchronously, the methods must belong to a single Apex class, Flow test or Agentforce agents test. To run all tests of a certain category, use --test-level with --test-category. If neither flag is specified, all local tests for all categories are run by default. You can also use the --class-names and --suite-names flags to run Apex test classes or suites.
11+
To run specific tests, use the --tests flag and pass it the names of Apex and Flow tests. For Apex, simply specify the name of the Apex test class. For Flows, use the format "FlowTesting.<name-of-flow-test>". To find the name of all the flow tests in your org, run this command and specify the Flow category, such as "sf logic run test --synchronous --test-category Flow --test-level RunAllTestsInOrg". The command displays a table of all the flow tests it ran; see the "TEST NAME" column for the full name of all available flow tests in your org.
12+
13+
You can also run specific test methods, although if you run the tests synchronously, the methods must belong to a single Apex class or Flow test. To run all tests of a certain category, use --test-category and --test-level together. If neither of these flags is specified, all local tests for all categories are run by default. You can also use the --class-names and --suite-names flags to run Apex test classes or suites.
1214

1315
To see code coverage results, use the --code-coverage flag with --result-format. The output displays a high-level summary of the test run and the code coverage values for the tested classes, flows or Agentforce agents. If you specify human-readable result format, use the --detailed-coverage flag to see detailed coverage results for each test method run.
1416

@@ -18,7 +20,7 @@ You must have the "View All Data" org system permission to use this command. The
1820

1921
- Run a mix of specific Apex and Flow tests asynchronously in your default org:
2022

21-
<%= config.bin %> <%= command.id %> --tests MyApexClassTest --tests FlowTest.ProcessOrder
23+
<%= config.bin %> <%= command.id %> --tests MyApexClassTest,FlowTesting.Modify_Account_Desc.Modify_Account_Desc_TestAccountDescription
2224

2325
- Run all local Apex and Flow tests and wait for the results to complete; run the tests in the org with alias "my-scratch":
2426

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@salesforce/plugin-apex",
33
"description": "Apex commands",
4-
"version": "3.7.1",
4+
"version": "3.8.0",
55
"author": "Salesforce",
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {

test/.eslintrc.cjs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/*
2-
* Copyright (c) 2021, salesforce.com, inc.
3-
* All rights reserved.
4-
* Licensed under the BSD 3-Clause license.
5-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6-
*/
7-
81
module.exports = {
92
extends: '../.eslintrc.cjs',
103
// Allow describe and it

0 commit comments

Comments
 (0)