apextestlist 1.10.1 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +80 -33
- package/oclif.lock +822 -804
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## [1.10.2](https://github.com/renatoliveira/apex-test-list/compare/v1.10.1...v1.10.2) (2025-04-06)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** bump @oclif/core from 4.2.6 to 4.2.10 ([d08a974](https://github.com/renatoliveira/apex-test-list/commit/d08a97414645c85c9a692e2a2aac29052c4ac8f9))
|
|
14
|
+
|
|
8
15
|
## [1.10.1](https://github.com/renatoliveira/apex-test-list/compare/v1.10.0...v1.10.1) (2025-02-13)
|
|
9
16
|
|
|
10
17
|
|
package/README.md
CHANGED
|
@@ -2,34 +2,52 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/apextestlist) [](https://npmjs.org/package/apextestlist) [](https://raw.githubusercontent.com/salesforcecli/apextestlist/main/LICENSE.txt)
|
|
4
4
|
|
|
5
|
-
A plugin that generates a list of tests that your
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
A plugin that generates a list of tests that your automated process should run, so you can save time by not running all tests in your Salesforce org and avoid specifying them manually.
|
|
6
|
+
|
|
7
|
+
<!-- TABLE OF CONTENTS -->
|
|
8
|
+
<details>
|
|
9
|
+
<summary>Table of Contents</summary>
|
|
10
|
+
|
|
11
|
+
- [Install](#install)
|
|
12
|
+
- [Usage](#usage)
|
|
13
|
+
- [1. `@Tests:` (Custom Comment Annotation)](#1-tests-custom-comment-annotation)
|
|
14
|
+
- [2. `@TestSuites:` (Custom Comment Annotation)](#2-testsuites-custom-comment-annotation)
|
|
15
|
+
- [3. `@isTest` (Apex Annotation)](#3-istest-apex-annotation)
|
|
16
|
+
- [Running the Tool](#running-the-tool)
|
|
17
|
+
- [Handling Missing Tests](#handling-missing-tests)
|
|
18
|
+
- [Command Reference](#command-reference)
|
|
19
|
+
- [Issues](#issues)
|
|
20
|
+
- [License](#license)
|
|
21
|
+
</details>
|
|
8
22
|
|
|
9
23
|
## Install
|
|
10
24
|
|
|
11
|
-
Simply
|
|
25
|
+
Simply install the plugin using `sf`:
|
|
12
26
|
|
|
13
|
-
```
|
|
27
|
+
```sh
|
|
14
28
|
sf plugins install apextestlist
|
|
15
29
|
```
|
|
16
30
|
|
|
17
31
|
## Usage
|
|
18
32
|
|
|
19
|
-
|
|
33
|
+
This tool identifies Apex tests using three annotations:
|
|
20
34
|
|
|
21
|
-
|
|
35
|
+
### 1. `@Tests:` (Custom Comment Annotation)
|
|
22
36
|
|
|
23
|
-
|
|
37
|
+
Classes can specify which tests should be run using a comment with the `@Tests:` prefix. Multiple tests can be separated by commas, spaces, or both.
|
|
24
38
|
|
|
25
39
|
```java
|
|
26
|
-
// @Tests: SampleTest,SuperSampleTest
|
|
40
|
+
// @Tests: SampleTest, SuperSampleTest
|
|
27
41
|
public class Sample {
|
|
28
42
|
// ...
|
|
29
43
|
}
|
|
30
44
|
```
|
|
31
45
|
|
|
32
|
-
|
|
46
|
+
This means that `SampleTest` and `SuperSampleTest` should be executed when `Sample.cls` is modified.
|
|
47
|
+
|
|
48
|
+
### 2. `@TestSuites:` (Custom Comment Annotation)
|
|
49
|
+
|
|
50
|
+
Test suites can be specified using the `@TestSuites:` prefix. Multiple suites can be separated by commas or spaces.
|
|
33
51
|
|
|
34
52
|
```java
|
|
35
53
|
// @TestSuites: SampleSuite SampleSuite2
|
|
@@ -38,71 +56,100 @@ public class Sample {
|
|
|
38
56
|
}
|
|
39
57
|
```
|
|
40
58
|
|
|
41
|
-
|
|
59
|
+
This tells the tool to include all tests contained in `SampleSuite` and `SampleSuite2`.
|
|
42
60
|
|
|
43
|
-
|
|
61
|
+
### 3. `@isTest` (Apex Annotation)
|
|
44
62
|
|
|
45
|
-
|
|
63
|
+
The tool also detects all Apex classes marked with the [`@isTest`](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_isTest.htm) annotation. Any class or method marked with this annotation is assumed to be a test.
|
|
46
64
|
|
|
47
|
-
|
|
65
|
+
```java
|
|
66
|
+
@isTest
|
|
67
|
+
private class SampleTest {
|
|
68
|
+
// This test will be included automatically
|
|
69
|
+
}
|
|
70
|
+
```
|
|
48
71
|
|
|
49
|
-
|
|
72
|
+
## Running the Tool
|
|
73
|
+
|
|
74
|
+
To generate a test list, run the command in any Salesforce DX project:
|
|
50
75
|
|
|
51
76
|
```sh
|
|
52
77
|
sf apextests list --format sf
|
|
53
|
-
$ --tests SampleTest SuperSampleTest Sample2Test SuperSample2Test
|
|
54
78
|
```
|
|
55
79
|
|
|
56
|
-
|
|
80
|
+
Example output:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
--tests SampleTest SuperSampleTest Sample2Test SuperSample2Test
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
This command is useful in CI/CD pipelines, dynamically generating the test list for deployments:
|
|
57
87
|
|
|
58
88
|
```sh
|
|
59
89
|
sf project deploy start $(sf apextests list)
|
|
60
90
|
```
|
|
61
91
|
|
|
62
|
-
|
|
92
|
+
The final deployment command would look like:
|
|
63
93
|
|
|
64
94
|
```sh
|
|
65
95
|
sf project deploy start --tests SampleTest SuperSampleTest Sample2Test SuperSample2Test SampleTriggerTest
|
|
66
96
|
```
|
|
67
97
|
|
|
98
|
+
### Handling Missing Tests
|
|
99
|
+
|
|
100
|
+
By default, this tool does **not** verify if the tests specified in `@Tests:` or `@TestSuites:` exist in the project. To enable warnings for missing tests, use:
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
sf apextests list --ignore-missing-tests
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
This will print warnings for missing tests and exclude them from the output.
|
|
107
|
+
|
|
108
|
+
## Command Reference
|
|
109
|
+
|
|
68
110
|
```
|
|
69
111
|
USAGE
|
|
70
112
|
$ sf apextests list -f <value> -x <value> -s -d <value> [--json]
|
|
71
113
|
|
|
72
114
|
FLAGS
|
|
73
|
-
-f, --format=<value>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
-
|
|
115
|
+
-f, --format=<value> Output format. Available options:
|
|
116
|
+
- `sf` (default): CLI-friendly test list
|
|
117
|
+
- `csv`: Comma-separated values
|
|
118
|
+
-x, --manifest=<value> Manifest XML file (package.xml) to filter test annotations.
|
|
119
|
+
-s, --ignore-missing-tests [default: false] Ignore test methods that are not found in any local package directories.
|
|
77
120
|
-d, --ignore-package-directory Ignore a package directory when looking for test annotations.
|
|
78
|
-
Should match how they are declared in
|
|
121
|
+
Should match how they are declared in "sfdx-project.json".
|
|
79
122
|
Can be declared multiple times.
|
|
80
123
|
|
|
81
124
|
GLOBAL FLAGS
|
|
82
|
-
--json Format output as
|
|
83
|
-
|
|
84
|
-
DESCRIPTION
|
|
85
|
-
Lists tests in a package.xml file or from your package directories.
|
|
125
|
+
--json Format output as JSON.
|
|
86
126
|
|
|
87
127
|
EXAMPLES
|
|
88
|
-
List all test annotations found in
|
|
128
|
+
List all test annotations found in package directories in Salesforce CLI format:
|
|
89
129
|
|
|
90
130
|
$ sf apextests list --format sf
|
|
91
131
|
|
|
92
|
-
List all test annotations
|
|
132
|
+
List all test annotations in CSV format:
|
|
93
133
|
|
|
94
134
|
$ sf apextests list --format csv
|
|
95
135
|
|
|
96
|
-
List test annotations
|
|
136
|
+
List test annotations only for Apex classes/triggers in a manifest file:
|
|
97
137
|
|
|
98
138
|
$ sf apextests list --format sf --manifest package.xml
|
|
99
139
|
|
|
100
|
-
List test annotations only if they
|
|
140
|
+
List test annotations only if they exist in the package directories:
|
|
101
141
|
|
|
102
142
|
$ sf apextests list --format sf --ignore-missing-tests
|
|
103
143
|
|
|
104
|
-
|
|
144
|
+
Exclude annotations found in the "force-app" directory:
|
|
105
145
|
|
|
106
146
|
$ sf apextests list -d "force-app"
|
|
107
|
-
|
|
108
147
|
```
|
|
148
|
+
|
|
149
|
+
## Issues
|
|
150
|
+
|
|
151
|
+
If you encounter any issues or would like to suggest features, please create an [issue](https://github.com/renatoliveira/apex-test-list/issues).
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
This project is licensed under the BSD-3 license. Please see the [LICENSE](https://github.com/renatoliveira/apex-test-list/blob/master/LICENSE) file for details.
|