Skip to content

feat: add test run execution, stats, and metrics support - #2

Merged
harry-rhesis merged 7 commits into
mainfrom
feat/test-run-support
Mar 30, 2026
Merged

feat: add test run execution, stats, and metrics support#2
harry-rhesis merged 7 commits into
mainfrom
feat/test-run-support

Conversation

@harry-rhesis

@harry-rhesis harry-rhesis commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add test set execution support (execute, rescore, lastRun) to TestSetClient, matching the Python SDK's TestSet.execute() / TestSet.rescore() / TestSet.last_run() capabilities
  • Add typed stats models and client methods for both test run and test result analytics (TestRunClient.stats(), TestResultClient.stats()) with mode enums and full filter parameter support
  • Add test set metric management (getMetrics, addMetric, removeMetric) and test association (addTests, removeTests) to TestSetClient
  • Fix TestRun.status deserialization to handle both plain strings and nested objects from the API
  • Add 14 WireMock unit tests, 18 integration tests, 5 runnable examples, and update README/CHANGELOG for 0.1.2

Changes

New files (27)

  • ExecutionMode, TestRunStatsMode, TestResultStatsMode enums
  • ExecutionRequest model with nested ExecutionOptions
  • 14 typed stats records under entities/stats/ (TestRunStats, TestResultStats, MetricStats, OverallStats, StatusDistribution, ResultDistribution, TimelineData, etc.)
  • TestRunIntegrationTest (18 tests against live API)
  • 5 example files + examples README.md

Modified files (7)

  • TestSetClient — execute, rescore, lastRun, metrics, test association
  • TestRunClient — typed stats() with mode/filter overloads
  • TestResultClient — typed stats() with 18 filter parameters
  • TestRun — status deserialization fix, new fields
  • ClientWiremockTest — 14 new WireMock tests
  • EntityTest — updated for new TestRun signature
  • README.md, CHANGELOG.md, pom.xml — docs and version bump to 0.1.2

Test plan

  • All 47 unit tests pass (including 14 new WireMock tests)
  • All 20 integration tests pass against live API (including 18 new stats/execution tests)
  • Compilation clean with no linter errors
  • PMD check passes
  • Spotless formatting check passes
  • CI: Check Code Format — passed
  • CI: Run Tests — passed

- Change status from Object to String with NameStringDeserializer to
  handle both plain strings and nested {"name":"..."} objects from API
- Add createdAt, nanoId, testCount, passRate fields
- Update EntityTest to use builder pattern for TestRun construction
- Add ExecutionMode enum (Parallel/Sequential)
- Add ExecutionRequest model with nested ExecutionOptions
- Add TestSetClient.execute() and rescore() for triggering test runs
- Add TestSetClient.lastRun() to fetch most recent completed run
- Add metric management: getMetrics(), addMetric(), removeMetric()
- Add test association: addTests(), removeTests()
- Add TestRunStatsMode and TestResultStatsMode enums
- Add typed response models: TestRunStats, TestResultStats, and all
  nested models (StatusDistribution, ResultDistribution, MetricStats,
  OverallStats, TimelineData, TestRunSummary, etc.)
- Update TestRunClient.stats() to return typed TestRunStats with
  overloads for mode, run IDs, and full filter params
- Add TestResultClient.stats() with mode and 18 filter parameters
  matching the Python SDK
- Add 14 WireMock tests: execute, rescore, lastRun, nested status
  deserialization, typed run/result stats with modes and filters,
  metrics, test association
- Add TestRunIntegrationTest with 18 tests covering run lifecycle,
  stats modes (summary, status, all), result stats (metrics, behavior,
  category, overall), filtered queries, execution, and last run
- Add ExecuteTestSetExample: parallel, sequential, custom metrics
- Add TestRunWorkflowExample: list runs, results, stats, last run,
  rescore
- Add TestSetMetricsExample: metric and test association management
- Add TestRunStatsExample: summary, distribution, timeline, filtering
- Add TestResultStatsExample: pass rates by metric, behavior,
  category, topic, per-run summaries
- Add examples README with setup instructions and quick reference
- Update project README with new features and all 9 examples
@harry-rhesis
harry-rhesis merged commit ad209b1 into main Mar 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant