Skip to content

Commit ceae5c3

Browse files
committed
docs: document --output formats and a github-actions CI sample
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
1 parent 4577165 commit ceae5c3

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,51 @@ $ docker run -it quay.io/microcks/microcks-cli:latest microcks test 'Beer Catalo
159159
```
160160

161161

162+
## Machine-readable test output
163+
164+
`microcks test` accepts `--output` to control how the result is rendered:
165+
166+
| Value | Output |
167+
| --- | --- |
168+
| `text` (default) | Human-readable summary |
169+
| `json` | The full `TestResult` as JSON |
170+
| `yaml` | The full `TestResult` as YAML |
171+
| `github-actions` | GitHub Actions workflow commands (annotations + log groups + step summary) |
172+
173+
For machine formats (`json`/`yaml`/`github-actions`), progress goes to **stderr**
174+
and only the formatted result is written to **stdout**, so it can be piped or
175+
parsed cleanly:
176+
177+
```bash
178+
microcks test "Pastry API:1.0.0" http://localhost:8080/api OPEN_API_SCHEMA \
179+
--microcksURL=http://localhost:8585/api --output=json > result.json
180+
```
181+
182+
### GitHub Actions
183+
184+
With `--output=github-actions`, failures surface as `::error::` annotations,
185+
each operation is wrapped in a collapsible `::group::`, and a per-operation table
186+
is appended to the job summary (`$GITHUB_STEP_SUMMARY`). Set
187+
`MICROCKS_ACTIONS_VERBOSE=true` to also emit `::notice::` for passing operations.
188+
189+
```yaml
190+
# .github/workflows/contract-test.yml
191+
name: contract-test
192+
on: [pull_request]
193+
jobs:
194+
contract-test:
195+
runs-on: ubuntu-latest
196+
steps:
197+
- uses: actions/checkout@v4
198+
- name: Microcks contract test
199+
run: |
200+
microcks test "Pastry API:1.0.0" "${{ env.API_URL }}" OPEN_API_SCHEMA \
201+
--microcksURL=${{ secrets.MICROCKS_URL }} \
202+
--keycloakClientId=${{ secrets.MICROCKS_CLIENT_ID }} \
203+
--keycloakClientSecret=${{ secrets.MICROCKS_CLIENT_SECRET }} \
204+
--output=github-actions
205+
```
206+
162207
## Tekton tasks
163208
164209
This repository also contains different [Tekton](https://tekton.dev/) tasks definitions and sample pipelines. You'll find under the `/tekton` folder the resource for current `v1beta1` Tekton API version and the older `v1alpha1` under `tekton/v1alpha1`.

documentation/cmd/test.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ One of:
3434
| `--filteredOperations` | Comma-separated list of operations to test |
3535
| `--operationsHeaders` | Custom headers for operations as JSON string |
3636
| `--oAuth2Context` | OAuth2 client context as JSON string |
37+
| `--output` | Output format: `text` (default), `json`, `yaml`, or `github-actions` |
3738

3839

3940
### Options Inherited from Parent Commands

0 commit comments

Comments
 (0)