# Test Reports

## GET /sfp/api/testreports/apex-tests/results

> Get all apex test results for a repository

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.9.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/sfp/api/testreports/apex-tests/results":{"get":{"operationId":"ApexTestResultsController_getAllResults","summary":"Get all apex test results for a repository","parameters":[{"name":"repository","required":true,"in":"query","description":"Repository identifier (org/repo)","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Maximum number of results","schema":{"type":"string"}}],"responses":{"200":{"description":"List of test results"},"403":{"description":"Forbidden - Requires role: member, owner, application"}},"tags":["Test Reports"]}}}}
```

## POST /sfp/api/testreports/apex-tests/results

> Store a new apex test result

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.9.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"CreateApexTestResultDto":{"type":"object","properties":{"environment":{"type":"string","description":"Environment name"},"repositoryIdentifier":{"type":"string","description":"Repository identifier (org/repo)"},"timestamp":{"type":"string","description":"Timestamp in ISO 8601 format"},"duration":{"type":"number","description":"Total duration in seconds"},"testExecutionTime":{"type":"number","description":"Test execution time in seconds"},"commandTime":{"type":"number","description":"Command overhead time in seconds"},"summary":{"$ref":"#/components/schemas/ApexTestSummaryDto"},"testCases":{"type":"array","items":{"$ref":"#/components/schemas/ApexTestCaseDto"}},"metadata":{"$ref":"#/components/schemas/ApexTestMetadataDto"},"coverage":{"$ref":"#/components/schemas/ApexCoverageInfoDto"}},"required":["environment","repositoryIdentifier","timestamp","duration","testExecutionTime","commandTime","summary","testCases","metadata","coverage"]},"ApexTestSummaryDto":{"type":"object","properties":{"totalTests":{"type":"number"},"passed":{"type":"number"},"failed":{"type":"number"},"skipped":{"type":"number"},"passingRate":{"type":"number","description":"Passing rate percentage (0-100)"},"outcome":{"type":"string","enum":["Passed","Failed","CompletedWithFailures"]},"overallCoverage":{"type":"number","description":"Overall coverage percentage (0-100)"},"coveredLines":{"type":"number"},"totalLines":{"type":"number"}},"required":["totalTests","passed","failed","skipped","passingRate","outcome","overallCoverage","coveredLines","totalLines"]},"ApexTestCaseDto":{"type":"object","properties":{"id":{"type":"string","description":"Salesforce test method ID"},"name":{"type":"string","description":"Full test name"},"className":{"type":"string","description":"Test class name"},"methodName":{"type":"string","description":"Test method name"},"time":{"type":"number","description":"Execution time in milliseconds"},"status":{"type":"string","enum":["passed","failed","skipped"]},"failureMessage":{"type":"string","description":"Failure message if test failed"},"stackTrace":{"type":"string","description":"Stack trace if test failed"}},"required":["id","name","className","methodName","time","status"]},"ApexTestMetadataDto":{"type":"object","properties":{"testRunId":{"type":"string","description":"Salesforce test run ID"},"username":{"type":"string","description":"Salesforce username"},"testLevel":{"type":"string","enum":["RunLocalTests","RunAllTestsInOrg","RunSpecifiedTests"]},"scheduledRun":{"type":"boolean","description":"Whether this was a scheduled run"}},"required":["testRunId","username","testLevel"]},"ApexCoverageInfoDto":{"type":"object","properties":{"overallCoverage":{"type":"number"},"totalLines":{"type":"number"},"coveredLines":{"type":"number"},"classes":{"type":"array","items":{"$ref":"#/components/schemas/ApexClassCoverageDto"}},"uncoveredClasses":{"type":"array","items":{"type":"string"}},"belowThreshold":{"type":"array","items":{"$ref":"#/components/schemas/ApexClassCoverageDto"}}},"required":["overallCoverage","totalLines","coveredLines","classes","uncoveredClasses","belowThreshold"]},"ApexClassCoverageDto":{"type":"object","properties":{"name":{"type":"string"},"id":{"type":"string"},"coverage":{"type":"number"},"totalLines":{"type":"number"},"coveredLines":{"type":"number"},"status":{"type":"string","enum":["pass","warning","fail"]}},"required":["name","id","coverage","totalLines","coveredLines","status"]}}},"paths":{"/sfp/api/testreports/apex-tests/results":{"post":{"operationId":"ApexTestResultsController_storeResult","summary":"Store a new apex test result","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApexTestResultDto"}}}},"responses":{"201":{"description":"Test result stored successfully"},"400":{"description":"Invalid request body"},"403":{"description":"Forbidden - Requires role: owner, application"}},"tags":["Test Reports"]}}}}
```

## GET /sfp/api/testreports/apex-tests/results/{environmentName}

> Get latest apex test result for an environment

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.9.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/sfp/api/testreports/apex-tests/results/{environmentName}":{"get":{"operationId":"ApexTestResultsController_getLatestResult","summary":"Get latest apex test result for an environment","parameters":[{"name":"environmentName","required":true,"in":"path","description":"Environment name","schema":{"type":"string"}},{"name":"repository","required":true,"in":"query","description":"Repository identifier (org/repo)","schema":{"type":"string"}}],"responses":{"200":{"description":"Latest test result for the environment"},"403":{"description":"Forbidden - Requires role: member, owner, application"},"404":{"description":"No results found for environment"}},"tags":["Test Reports"]}}}}
```

## GET /sfp/api/testreports/apex-tests/results/{environmentName}/history

> Get apex test result history for an environment

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.9.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/sfp/api/testreports/apex-tests/results/{environmentName}/history":{"get":{"operationId":"ApexTestResultsController_getResultHistory","summary":"Get apex test result history for an environment","parameters":[{"name":"environmentName","required":true,"in":"path","description":"Environment name","schema":{"type":"string"}},{"name":"repository","required":true,"in":"query","description":"Repository identifier (org/repo)","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Maximum number of results","schema":{"type":"string"}}],"responses":{"200":{"description":"Test result history for the environment"},"403":{"description":"Forbidden - Requires role: member, owner, application"}},"tags":["Test Reports"]}}}}
```

## GET /sfp/api/testreports/apex-tests/dashboard/summary

> Get dashboard summary for all environments in a repository

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.9.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/sfp/api/testreports/apex-tests/dashboard/summary":{"get":{"operationId":"ApexTestResultsController_getDashboardSummary","summary":"Get dashboard summary for all environments in a repository","parameters":[{"name":"repository","required":true,"in":"query","description":"Repository identifier (org/repo)","schema":{"type":"string"}}],"responses":{"200":{"description":"Dashboard summary with all environments"},"403":{"description":"Forbidden - Requires role: member, owner, application"}},"tags":["Test Reports"]}}}}
```

## GET /sfp/api/testreports/apex-tests/dashboard/{environmentName}

> Get detailed dashboard for a single environment

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.9.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/sfp/api/testreports/apex-tests/dashboard/{environmentName}":{"get":{"operationId":"ApexTestResultsController_getEnvironmentDashboard","summary":"Get detailed dashboard for a single environment","parameters":[{"name":"environmentName","required":true,"in":"path","description":"Environment name","schema":{"type":"string"}},{"name":"repository","required":true,"in":"query","description":"Repository identifier (org/repo)","schema":{"type":"string"}}],"responses":{"200":{"description":"Detailed environment dashboard"},"403":{"description":"Forbidden - Requires role: member, owner, application"},"404":{"description":"No results found for environment"}},"tags":["Test Reports"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flxbl.io/flxbl/sfp-server/api-reference/test-reports.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
