Skip to content

Add core Insights API endpoints (test cases, errors, trends) - #629

Merged
diemol merged 2 commits into
mainfrom
support-insights-endpoint-63
Sep 16, 2026
Merged

diemol merged 2 commits into
mainfrom
support-insights-endpoint-63

Conversation

@diemol

@diemol diemol commented Sep 16, 2026

Copy link
Copy Markdown
Member

Description

Extends InsightsEndpoint (previously limited to getTestResults) with 8 new methods covering the most commonly used part of the Insights API:

  • getTestMetricsSummaryGET /v1/analytics/insights/test-metrics
  • getTestTrendsGET /v1/analytics/trends/tests
  • getTestsGET /v2/insights/{source}/tests
  • getTestCasesGET /v2/insights/{source}/test-cases
  • getTestCasesStatsGET /v2/insights/{source}/test-cases/stats
  • getErrorsGET /v2/insights/{source}/errors
  • getTrendsTestsGET /v2/insights/{source}/trends/tests
  • getTrendsErrorsGET /v2/insights/{source}/trends/errors

Each method has a dedicated parameter builder (under com.saucelabs.saucerest.model.insights, following the existing TestResultParameter/LookupBuildsParameters builder conventions) and response model classes matching the documented API responses.

Filters, Activity, Concurrency, Coverage, and the cross-source ("all sources") endpoint variants are intentionally left out of this PR to keep it reviewable; InsightsEndpoint remains annotated @Unfinished with an updated message describing what's left.

Note: the test-execution response model is named TestExecution rather than Test, to avoid colliding with org.junit.jupiter.api.Test in files that need both imports.

Motivation and Context

Closes #63 — the library only exposed a single, incomplete Insights endpoint (getTestResults, annotated @Unfinished), despite the Insights API being one of the most requested integrations.

How Has This Been Tested?

  • mvn test-compile — full compile of main and test sources.
  • mvn test -Dtest=com.saucelabs.saucerest.unit.** — full unit suite, including 8 new parameter-builder test classes covering toMap() serialization and required-field validation (org_id, query, start/end vs time_range).
  • Extended the existing live-API integration test (InsightsEndpointTest) with one test per new endpoint; these follow the existing pattern of running against real Sauce Labs credentials and were not run in this environment (no credentials available), consistent with how the pre-existing getTestResultTest integration test is exercised.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (change which improves current code base; please describe the change)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Screenshots (if appropriate):

N/A

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • All new and existing tests passed locally
  • I have added necessary documentation (if appropriate)

Further comments

This covers the "core" slice of the Insights API (test executions, test cases, errors, trends) rather than the full surface described in the linked docs, since the full API is ~25 endpoints across 8 categories (Analytics, Filters, Activity, Errors, Test Cases, Concurrency, Coverage, Trends). Happy to follow up with the remaining groups in separate PRs if maintainers want them.

🤖 Generated with Claude Code

Extends InsightsEndpoint (previously limited to getTestResults) with
getTestMetricsSummary, getTestTrends, getTests, getTestCases,
getTestCasesStats, getErrors, getTrendsTests, and getTrendsErrors,
covering the most commonly used parts of the Insights API. Adds
matching parameter builders and response models under model.insights.

Filters, Activity, Concurrency, Coverage, and the cross-source (all
sources) endpoint variants are intentionally left for follow-up work;
InsightsEndpoint remains annotated @unfinished.

Fixes #63

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Sep 16, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 210 complexity · 80 duplication

Metric Results
Complexity 210
Duplication 80

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Builder's explicit public no-arg constructor was identical to the
one the compiler generates by default.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@diemol
diemol merged commit 435e7bc into main Sep 16, 2026
4 checks passed
@diemol
diemol deleted the support-insights-endpoint-63 branch September 16, 2026 13:54
diemol added a commit that referenced this pull request Sep 16, 2026
…#631)

Default AnalyticsTrendsParameter interval to 1d

GET /v1/analytics/trends/tests rejects requests with a 422 when
`interval` is omitted, even though the docs list it as optional
with a default of 1d. Default it client-side to match the documented
behavior, the same way TestResultParameter.Builder already defaults
`size`.

Verified against the live API (both start/end and time_range paths);
this was breaking the getTestTrendsTest integration test in CI on
every PR since #629 merged.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.

Support Insights endpoint

1 participant