Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ A Go CLI tool (`gorp`) and library (`pkg/gorp`) for [ReportPortal](https://repor
| `internal/commands/` | CLI command implementations (see below) |
| `pkg/gorp/` | Hand-written public library (see below) |
| `pkg/openapi/` | **Generated** OpenAPI client — never edit manually |
| `examples/showcase/` | Runnable `pkg/gorp` example: a rich launch (attribute contract, nesting, parameters, fixtures, retries, defect types, reruns) |
| `scripts/` | OpenAPI spec preprocessing filter (`openapi-preprocess.jq`, run through the `jq` Docker image), short-name type aliases template (`openapi-compat/`) |
| `Taskfile.yml` | Task runner for build, test, lint, fmt, OpenAPI codegen |
| `.claude/skills/reportportal/` | Skill for CLI/library reporting workflows (`start-launch`, `test2json`, quality gates, etc.). `.cursor/skills/reportportal/SKILL.md` symlinks to it — same file, don't edit both |
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,10 @@ all, err := client.GetAllLaunchesByFilterString(ctx, "my_project",
| `gorp.WithApiKeyAuth(ctx, apiKey)` | API key (user token) — recommended |
| `gorp.WithPasswordOwnerGrantAuth(ctx, cfg, user, pass)` | OAuth2 resource-owner password grant |

### Full example

[`examples/showcase`](examples/showcase) reports a rich launch with the reporting client: an attribute contract, nested containers, parameters, fixtures, nested steps, every log level and attachments, retries with `retryOf`, defect types, history across builds and launch reruns (`rerunOf`). Run it against a sandbox project with `go run ./examples/showcase -build 1`.

---

## Environment Variables
Expand Down
40 changes: 40 additions & 0 deletions examples/showcase/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Showcase: a rich launch reported with `pkg/gorp`

`showcase` reports a deterministic "Payments API" regression to ReportPortal using the `pkg/gorp` reporting client directly. It covers most of what an agent can send, so it doubles as a reference for writing Go integrations.

| Feature | Where in the launch |
|---|---|
| Launch attribute contract (`env`, `build`, `version`, `branch`, `suite`, `platform`, `team`, `trigger`) and a Markdown description with a CI link | launch |
| System attributes `agent`, `os`, `go`, `skippedIssue` | launch info |
| Suites, nested `TEST` containers (up to three levels), `STEP` tests | `payments-api`, `ledger-service` |
| Stable identity: `testCaseId` (with the parameter variant in it), `codeRef` | every step |
| Parameters | `full refund` (`currency`, `amount`), `convert` (`from`, `to`), `… account` (`kind`) |
| Item attributes (`feature`, `priority`, `owner`, `tms_id`) and descriptions | tests and containers |
| `BEFORE_SUITE`, `BEFORE_METHOD`, `AFTER_METHOD` fixtures | `payments-api`, `Refunds` |
| Nested steps without statistics (`hasStats=false`) | `partial refund` |
| All log levels, a Markdown log, attachments (PNG, JSON, text) in multipart batches | `payload trace`, failures |
| Retries: two failed attempts (finished as No Defect), then a pass, chained with `retryOf` | `delivery retries on 503` |
| Skipped as No Defect and skipped as To Investigate | `signature rotation`, `export to S3` |
| Defect types on finish: Product Bug, Automation Bug, System Issue (with comments); To Investigate left on purpose | failures |
| History across builds: a regression appears in build 102, a bug is fixed in 102 and comes back in 103 | `-build` |
| Launch reruns (`rerun` + `rerunOf`): the failed tests are reported again, become retries of the old items, and the server recomputes the statistics | `-mode rerun1`, `-mode rerun2` |

## Run

```sh
export GORP_HOST=https://reportportal.example.com GORP_PROJECT=my_project GORP_API_KEY=...

go run ./examples/showcase -build 101
go run ./examples/showcase -build 102
go run ./examples/showcase -build 103 # prints "ReportPortal Launch UUID: <uuid>" and the launch link

# two reruns of build 103 after fixes; the server keeps the UUID of the original launch
go run ./examples/showcase -build 103 -mode rerun1 -rerun-of <uuid>
go run ./examples/showcase -build 103 -mode rerun2 -rerun-of <uuid>
```

Use a sandbox project: each run creates a launch named `Go Showcase - Payments API`.

A rerun reports only some tests, so it finishes the launch **without** a status and lets the server compute it from all items, as the Java agents do. `-mode refinish -rerun-of <uuid>` reopens a launch as a rerun without reporting any test, so the server recomputes its status.

On ReportPortal 6.x, `GORP_PROJECT` is the project key, for example `superadmin_personal` (not the slug shown in the UI URL).
Loading
Loading