ado-sync 0.1.23 → 0.1.26
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/README.md +74 -711
- package/dist/azure/client.d.ts +3 -0
- package/dist/azure/client.js +6 -0
- package/dist/azure/client.js.map +1 -1
- package/dist/azure/test-cases.d.ts +8 -3
- package/dist/azure/test-cases.js +403 -24
- package/dist/azure/test-cases.js.map +1 -1
- package/dist/cli.js +51 -4
- package/dist/cli.js.map +1 -1
- package/dist/config.js +111 -5
- package/dist/config.js.map +1 -1
- package/dist/parsers/gherkin.d.ts +4 -1
- package/dist/parsers/gherkin.js +19 -4
- package/dist/parsers/gherkin.js.map +1 -1
- package/dist/parsers/markdown.d.ts +4 -1
- package/dist/parsers/markdown.js +5 -3
- package/dist/parsers/markdown.js.map +1 -1
- package/dist/parsers/shared.d.ts +18 -0
- package/dist/parsers/shared.js +40 -0
- package/dist/parsers/shared.js.map +1 -1
- package/dist/sync/engine.js +98 -5
- package/dist/sync/engine.js.map +1 -1
- package/dist/sync/publish-results.d.ts +33 -0
- package/dist/sync/publish-results.js +281 -0
- package/dist/sync/publish-results.js.map +1 -0
- package/dist/types.d.ts +151 -0
- package/docs/advanced.md +350 -0
- package/docs/configuration.md +293 -0
- package/docs/publish-test-results.md +119 -0
- package/docs/spec-formats.md +225 -0
- package/package.json +1 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# publish-test-results
|
|
2
|
+
|
|
3
|
+
Parses test result files (TRX, JUnit, Cucumber JSON) and publishes them to an Azure DevOps Test Run, linking results back to Test Cases via the sync tag.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ado-sync publish-test-results \
|
|
11
|
+
--testResult results/test-results.trx \
|
|
12
|
+
--runName "CI run #42"
|
|
13
|
+
|
|
14
|
+
# Multiple result files
|
|
15
|
+
ado-sync publish-test-results \
|
|
16
|
+
--testResult results/unit.trx \
|
|
17
|
+
--testResult results/integration.xml \
|
|
18
|
+
--testResultFormat junit
|
|
19
|
+
|
|
20
|
+
# Dry run — parse and summarise without publishing
|
|
21
|
+
ado-sync publish-test-results --testResult results/test.trx --dry-run
|
|
22
|
+
|
|
23
|
+
# Associate with a build
|
|
24
|
+
ado-sync publish-test-results \
|
|
25
|
+
--testResult results/test.trx \
|
|
26
|
+
--buildId 12345
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Options
|
|
30
|
+
|
|
31
|
+
| Option | Description |
|
|
32
|
+
|--------|-------------|
|
|
33
|
+
| `--testResult <path>` | Path to a result file. Repeatable. |
|
|
34
|
+
| `--testResultFormat <format>` | `trx` · `junit` · `cucumberJson`. Auto-detected from file extension/content when omitted. |
|
|
35
|
+
| `--runName <name>` | Name for the Test Run in Azure DevOps. Defaults to `ado-sync <ISO timestamp>`. |
|
|
36
|
+
| `--buildId <id>` | Build ID to associate with the Test Run. |
|
|
37
|
+
| `--dry-run` | Parse results and print summary without creating a run in Azure. |
|
|
38
|
+
| `--config-override` | Override config values (repeatable, same as other commands). |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Supported formats
|
|
43
|
+
|
|
44
|
+
| Format | Extension | Auto-detected |
|
|
45
|
+
|--------|-----------|---------------|
|
|
46
|
+
| TRX (Visual Studio / .NET) | `.trx` | Yes (XML root `<TestRun>`) |
|
|
47
|
+
| JUnit XML | `.xml` | Yes (XML root `<testsuites>` or `<testsuite>`) |
|
|
48
|
+
| Cucumber JSON | `.json` | Yes (JSON array of feature objects) |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Outcome mapping
|
|
53
|
+
|
|
54
|
+
| Source outcome | Azure outcome |
|
|
55
|
+
|----------------|---------------|
|
|
56
|
+
| `passed` / `pass` / `success` | `Passed` |
|
|
57
|
+
| `failed` / `fail` / `failure` / `error` | `Failed` |
|
|
58
|
+
| `skipped` / `ignored` / `pending` / `notExecuted` | `NotExecuted` |
|
|
59
|
+
| `inconclusive` | `Inconclusive` (or override with `treatInconclusiveAs`) |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Configuration
|
|
64
|
+
|
|
65
|
+
Results can also be configured in the config file under `publishTestResults`:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"publishTestResults": {
|
|
70
|
+
"testResult": {
|
|
71
|
+
"sources": [
|
|
72
|
+
{ "value": "results/unit.trx", "format": "trx" },
|
|
73
|
+
{ "value": "results/integration.xml", "format": "junit" }
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"treatInconclusiveAs": "Failed",
|
|
77
|
+
"testRunSettings": {
|
|
78
|
+
"name": "My CI Run",
|
|
79
|
+
"comment": "Automated sync run",
|
|
80
|
+
"runType": "Automated"
|
|
81
|
+
},
|
|
82
|
+
"testResultSettings": {
|
|
83
|
+
"comment": "Published by ado-sync"
|
|
84
|
+
},
|
|
85
|
+
"testConfiguration": {
|
|
86
|
+
"name": "Default"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### `publishTestResults` fields
|
|
93
|
+
|
|
94
|
+
| Field | Description |
|
|
95
|
+
|-------|-------------|
|
|
96
|
+
| `testResult.sources` | Array of `{ value, format }` objects. `value` is a path relative to config dir. |
|
|
97
|
+
| `treatInconclusiveAs` | Override inconclusive outcome. e.g. `"Failed"` or `"NotExecuted"`. |
|
|
98
|
+
| `flakyTestOutcome` | How to handle flaky tests: `"lastAttemptOutcome"` *(default)* · `"firstAttemptOutcome"` · `"worstOutcome"`. |
|
|
99
|
+
| `testConfiguration.name` | Name of the Azure test configuration to associate. |
|
|
100
|
+
| `testConfiguration.id` | ID of the Azure test configuration. |
|
|
101
|
+
| `testRunSettings.name` | Name for the Test Run. |
|
|
102
|
+
| `testRunSettings.comment` | Comment attached to the Test Run. |
|
|
103
|
+
| `testRunSettings.runType` | `"Automated"` *(default)* · `"Manual"`. |
|
|
104
|
+
| `testResultSettings.comment` | Comment applied to every test result. |
|
|
105
|
+
| `publishAttachmentsForPassingTests` | `"none"` *(default)* · `"files"` · `"all"`. |
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Output
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
ado-sync publish-test-results
|
|
113
|
+
Config: ado-sync.json
|
|
114
|
+
|
|
115
|
+
Total results: 42
|
|
116
|
+
38 passed 3 failed 1 other
|
|
117
|
+
Run ID: 9876
|
|
118
|
+
URL: https://dev.azure.com/my-org/MyProject/_testManagement/runs?runId=9876
|
|
119
|
+
```
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Spec file formats
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Gherkin `.feature`
|
|
6
|
+
|
|
7
|
+
Set `local.type: "gherkin"`. Standard Gherkin syntax is supported:
|
|
8
|
+
|
|
9
|
+
- `Feature` / `Scenario` / `Scenario Outline` / `Background`
|
|
10
|
+
- `Given` / `When` / `Then` / `And` / `But`
|
|
11
|
+
- Feature-level and scenario-level tags
|
|
12
|
+
- `Scenario Outline` with `Examples` tables — creates a **single** parametrized Test Case in Azure, not one TC per row
|
|
13
|
+
- Inline data tables (synced as sub-steps or plain text — see [Format configuration](advanced.md#format-configuration))
|
|
14
|
+
|
|
15
|
+
```gherkin
|
|
16
|
+
Feature: Checkout
|
|
17
|
+
|
|
18
|
+
Background:
|
|
19
|
+
Given I am on the storefront
|
|
20
|
+
|
|
21
|
+
@smoke
|
|
22
|
+
@tc:1041
|
|
23
|
+
Scenario: Add item and complete checkout
|
|
24
|
+
Given I am logged in as "standard_user"
|
|
25
|
+
When I add "Sauce Labs Backpack" to the cart
|
|
26
|
+
And I proceed through checkout with name "Test User" and zip "12345"
|
|
27
|
+
Then I see the order confirmation page
|
|
28
|
+
|
|
29
|
+
@tc:1042
|
|
30
|
+
Scenario Outline: Checkout with different users
|
|
31
|
+
Given I am logged in as "<user>"
|
|
32
|
+
When I complete a checkout
|
|
33
|
+
Then the result is "<result>"
|
|
34
|
+
|
|
35
|
+
Examples:
|
|
36
|
+
| user | result |
|
|
37
|
+
| standard_user | success |
|
|
38
|
+
| performance_glitch_user | success |
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Markdown `.md`
|
|
44
|
+
|
|
45
|
+
Set `local.type: "markdown"`. Each `### heading` is one test case. Scenarios are separated by `---`.
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
# My Feature Test Plan
|
|
49
|
+
|
|
50
|
+
## Test scenarios
|
|
51
|
+
|
|
52
|
+
### Login with valid credentials
|
|
53
|
+
@tc:1042 @smoke
|
|
54
|
+
|
|
55
|
+
Assumption: Fresh browser session.
|
|
56
|
+
|
|
57
|
+
Steps:
|
|
58
|
+
1. Navigate to https://example.com/login
|
|
59
|
+
2. Enter username "admin" and password "secret"
|
|
60
|
+
3. Click the Login button
|
|
61
|
+
|
|
62
|
+
Expected results:
|
|
63
|
+
- The dashboard page is shown
|
|
64
|
+
- The username appears in the top navigation
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### Login with invalid credentials
|
|
69
|
+
|
|
70
|
+
Steps:
|
|
71
|
+
1. Navigate to https://example.com/login
|
|
72
|
+
2. Enter username "wrong" and password "wrong"
|
|
73
|
+
3. Click the Login button
|
|
74
|
+
|
|
75
|
+
Expected results:
|
|
76
|
+
- An error message "Invalid credentials" is displayed
|
|
77
|
+
- The user remains on the login page
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Sections recognised (case-insensitive): `Steps:`, `Expected results:`. All other prose is captured as the test case description. Heading number prefixes (`### 1. Title` or `### Title`) are both supported.
|
|
83
|
+
|
|
84
|
+
### Playwright test-plan markdown
|
|
85
|
+
|
|
86
|
+
Markdown files generated by the Playwright MCP agent are fully supported. Set `local.type: "markdown"` and point `local.include` at the generated files.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## CSV `.csv`
|
|
91
|
+
|
|
92
|
+
Set `local.type: "csv"` to parse Azure DevOps / SpecSync tabular CSV exports.
|
|
93
|
+
|
|
94
|
+
**Expected column layout (9 columns):**
|
|
95
|
+
|
|
96
|
+
| Col | Field | Description |
|
|
97
|
+
|-----|-------|-------------|
|
|
98
|
+
| A (0) | ID | Azure Test Case ID — empty for new, filled after first push |
|
|
99
|
+
| B (1) | Work Item Type | Always `Test Case` (ignored) |
|
|
100
|
+
| C (2) | Title | `Scenario: My test` — non-empty on header row, empty on step rows |
|
|
101
|
+
| D (3) | Test Step | Step number — empty on header row |
|
|
102
|
+
| E (4) | Step Action | Step text, optionally prefixed with a Gherkin keyword |
|
|
103
|
+
| F (5) | Step Expected | Expected result text (optional) |
|
|
104
|
+
| G–I (6–8) | Area Path, Assigned To, State | Preserved but not used |
|
|
105
|
+
|
|
106
|
+
The first row (column headers) is always skipped automatically.
|
|
107
|
+
|
|
108
|
+
> **Note:** `ado-sync pull` is **not supported** for CSV files. Only push is supported.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Excel `.xlsx`
|
|
113
|
+
|
|
114
|
+
Set `local.type: "excel"`. Uses the same 9-column layout as CSV. ado-sync reads the raw worksheet XML (no external xlsx library) and handles both `t="str"` and `t="inlineStr"` cells from Azure DevOps exports.
|
|
115
|
+
|
|
116
|
+
> **Note:** `ado-sync pull` is **not supported** for Excel files. Only push is supported.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## ID tags
|
|
121
|
+
|
|
122
|
+
After a first push, ado-sync writes the Azure TC ID back into the local file.
|
|
123
|
+
|
|
124
|
+
| Format | Location |
|
|
125
|
+
|--------|----------|
|
|
126
|
+
| Gherkin | `@tc:12345` tag on its own line above the `Scenario:` line |
|
|
127
|
+
| Markdown | `@tc:12345` tag on the line immediately after the `### heading` |
|
|
128
|
+
| CSV | Numeric ID in column A of the matching title row |
|
|
129
|
+
| Excel | Numeric ID in cell A of the matching title row |
|
|
130
|
+
|
|
131
|
+
### Custom prefix
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{ "sync": { "tagPrefix": "azure" } }
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Result: `@azure:12345` in both Gherkin and Markdown files.
|
|
138
|
+
|
|
139
|
+
> **Warning:** Changing the prefix on an existing project means existing ID tags are no longer recognised. Do a project-wide find-and-replace before changing.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Tag filtering
|
|
144
|
+
|
|
145
|
+
All commands accept `--tags` to limit which scenarios are processed. Uses the standard Cucumber tag expression language.
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
ado-sync push --tags "@smoke"
|
|
149
|
+
ado-sync push --tags "@smoke and not @wip"
|
|
150
|
+
ado-sync pull --tags "@regression or @critical"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Tags are evaluated against all tags on a scenario, including:
|
|
154
|
+
|
|
155
|
+
- Tags on the `Feature` block (Gherkin)
|
|
156
|
+
- Tags on the `Scenario` / `Scenario Outline` block
|
|
157
|
+
- Tags on individual `Examples` tables
|
|
158
|
+
- Tags on the Markdown tag line (same `### heading` line or line below it)
|
|
159
|
+
- **Path-based auto-tags** — directory segments starting with `@` are automatically applied as tags:
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
specs/
|
|
163
|
+
@smoke/
|
|
164
|
+
login.feature ← all scenarios get tag 'smoke'
|
|
165
|
+
@regression/
|
|
166
|
+
@slow/
|
|
167
|
+
checkout.feature ← all scenarios get tags 'regression' and 'slow'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### `local.condition` — permanent filter
|
|
171
|
+
|
|
172
|
+
Use `local.condition` in config to permanently exclude scenarios without needing `--tags` on every command:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{ "local": { "condition": "@done and not (@ignored or @planned)" } }
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
This filter is applied before `--tags`, so it acts as a baseline inclusion gate.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Work item linking
|
|
183
|
+
|
|
184
|
+
Tags matching a configured `links` prefix are synced as Azure DevOps work item relations on the Test Case.
|
|
185
|
+
|
|
186
|
+
### Config
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"sync": {
|
|
191
|
+
"links": [
|
|
192
|
+
{ "prefix": "story", "relationship": "System.LinkTypes.Related" },
|
|
193
|
+
{ "prefix": "bug", "relationship": "System.LinkTypes.Related" },
|
|
194
|
+
{ "prefix": "req", "relationship": "Microsoft.VSTS.Common.TestedBy-Reverse" }
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Usage in Gherkin
|
|
201
|
+
|
|
202
|
+
```gherkin
|
|
203
|
+
@tc:1042 @story:555 @bug:789
|
|
204
|
+
Scenario: User can add items to cart
|
|
205
|
+
...
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Usage in Markdown
|
|
209
|
+
|
|
210
|
+
```markdown
|
|
211
|
+
### User can add items to cart
|
|
212
|
+
@tc:1042 @story:555 @bug:789
|
|
213
|
+
|
|
214
|
+
Steps:
|
|
215
|
+
1. Add an item to the cart
|
|
216
|
+
...
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
On each `push`, relations are synced: new links are added, stale links (whose tag was removed) are deleted. The `relationship` value is the ADO relation type — `"System.LinkTypes.Related"` is the default if omitted.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Attachments
|
|
224
|
+
|
|
225
|
+
Files can be attached to Azure Test Cases via tags. See [Attachments](advanced.md#attachments).
|