Skip to content

feat(api): add support for test report summary api

Following GitLab REST API documentation: https://docs.gitlab.com/api/pipelines/#get-a-test-report-summary-for-a-pipeline

This MR adds support for the following operation: GET /projects/:id/pipelines/:pipeline_id/test_report_summary

New Data Types:

// PipelineTestReportSummary contains a summary report of a test run
type PipelineTestReportSummary struct {
	Total      PipelineTotalSummary        `json:"total"`
	TestSuites []PipelineTestSuitesSummary `json:"test_suites"`
}

// PipelineTotalSummary contains a total summary of a test run
type PipelineTotalSummary struct {
	Time       float64              `json:"time"`
	Count      int                  `json:"count"`
	Success    int                  `json:"success"`
	Failed     int                  `json:"failed"`
	Skipped    int                  `json:"skipped"`
	Error      int                  `json:"error"`
	SuiteError *string              `json:"suite_error"`
	TestCases  []*PipelineTestCases `json:"test_cases"`
}

// PipelineTestSuitesSummary contains a test suite summary of a test run
type PipelineTestSuitesSummary struct {
	Name         string               `json:"name"`
	TotalTime    float64              `json:"total_time"`
	TotalCount   int                  `json:"total_count"`
	SuccessCount int                  `json:"success_count"`
	FailedCount  int                  `json:"failed_count"`
	SkippedCount int                  `json:"skipped_count"`
	ErrorCount   int                  `json:"error_count"`
	BuildIDs     []int                `json:"build_ids"`
	SuiteError   *string              `json:"suite_error"`
	TestCases    []*PipelineTestCases `json:"test_cases"`
}

Call:

testreport, resp, err := client.Pipelines.GetPipelineTestReportSummary(projectID, pipelineID int)
Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading