Skip to content

Add CustomStringConvertible to TestMetrics#226

Merged
kukushechkin merged 3 commits into
apple:mainfrom
kukushechkin:print-testmetrics-content
Jun 12, 2026
Merged

Add CustomStringConvertible to TestMetrics#226
kukushechkin merged 3 commits into
apple:mainfrom
kukushechkin:print-testmetrics-content

Conversation

@kukushechkin

Copy link
Copy Markdown
Contributor

Currently, when testing, there is not way to print out the counter to see what is in it.

Motivation:

Having a way to print a human-readable representation of the TestMetrics is useful during the debugging.

Modifications:

Conform TestMetrics to CustomStringConvertible and implement human-readable representation of its content.

Result:

TestMetrics object can now be printed and produces a string representation looking like this:

// TestMetrics:
// Counters:
//   TestCounter(requests, dimensions: [("method", "GET")], values: [10, 5], total: 15)
// Recorders:
//   TestRecorder(response.size, dimensions: [], aggregate: true, values: [1024.0])
// Timers:
//   TestTimer(latency, dimensions: [], valuesNanos: [1000000])

@kukushechkin kukushechkin requested a review from AzeemJiva June 11, 2026 10:46
@kukushechkin kukushechkin added the 🆕 semver/minor Adds new public API. label Jun 11, 2026
@kukushechkin kukushechkin merged commit 4d99a2e into apple:main Jun 12, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants