Documentation
¶
Index ¶
- Constants
- func MarshalCommands(flow FlowResult) ([]byte, error)
- func MarshalHTML(options HTMLOptions, flows []FlowResult) ([]byte, error)
- func MarshalJUnit(options JUnitOptions, flows []FlowResult) ([]byte, error)
- func SanitizeFlowName(name string) string
- type Artifact
- type CommandResult
- type Failure
- type FlowResult
- type HTMLOptions
- type JUnitOptions
- type Status
- type Writer
- func (writer *Writer) RegisterArtifact(kind, relativePath string) (Artifact, error)
- func (writer *Writer) WriteArtifact(kind, relativePath string, data []byte) (Artifact, error)
- func (writer *Writer) WriteCommands(flow FlowResult) (Artifact, error)
- func (writer *Writer) WriteFailureScreenshot(flowName string, sequence int64, data []byte) (Artifact, error)
- func (writer *Writer) WriteJUnit(options JUnitOptions, flows []FlowResult) (Artifact, error)
- func (writer *Writer) WriteManifest() (Artifact, error)
Constants ¶
const ( ArtifactKindCommands = "commands" ArtifactKindFailureScreenshot = "failure-screenshot" ArtifactKindJUnit = "junit" ArtifactKindManifest = "manifest" ManifestSchemaVersion = "flowbaton.artifacts/v1" )
const CommandsSchemaVersion = "flowbaton.commands/v1"
CommandsSchemaVersion identifies the on-disk commands.json contract.
Variables ¶
This section is empty.
Functions ¶
func MarshalCommands ¶
func MarshalCommands(flow FlowResult) ([]byte, error)
MarshalCommands renders a canonical commands.json document. It sorts copies of sequence-bearing and artifact fields and never mutates the supplied DTO.
func MarshalHTML ¶
func MarshalHTML(options HTMLOptions, flows []FlowResult) ([]byte, error)
MarshalHTML renders the run as a self-contained document.
Self-contained is a requirement, not a choice: a report is opened from a CI artifact bundle, offline, long after the run. Anything fetched over the network renders as a broken page at exactly the moment somebody needs it.
func MarshalJUnit ¶
func MarshalJUnit(options JUnitOptions, flows []FlowResult) ([]byte, error)
MarshalJUnit renders one testcase per flow. Failed flows become failures, skipped and cancelled flows become skipped testcases, and warned flows are successes because optional-command failures do not fail the flow.
func SanitizeFlowName ¶
SanitizeFlowName returns a portable ASCII path component for flow artifacts.
Types ¶
type CommandResult ¶
type CommandResult struct {
Sequence int64 `json:"sequence"`
Depth int `json:"depth"`
Keyword string `json:"keyword"`
Description string `json:"description"`
Status Status `json:"status"`
StartedAt time.Time `json:"startedAt"`
EndedAt time.Time `json:"endedAt"`
DurationMillis int64 `json:"durationMillis"`
Failure *Failure `json:"failure"`
Metadata map[string]string `json:"metadata"`
Artifacts []Artifact `json:"artifacts"`
}
CommandResult is the engine-neutral report shape for one executed command.
type FlowResult ¶
type FlowResult struct {
Name string `json:"name"`
// File is the flow's path relative to the run root, which is what the
// JUnit report's file= attribute carries. Separate from Description
// (the absolute path) because the contract reports sub/alpha.yaml, and
// only the caller that knows the root can work that out.
File string `json:"file,omitempty"`
Description string `json:"description"`
Status Status `json:"status"`
StartedAt time.Time `json:"startedAt"`
EndedAt time.Time `json:"endedAt"`
DurationMillis int64 `json:"durationMillis"`
Failure *Failure `json:"failure"`
Metadata map[string]string `json:"metadata"`
Artifacts []Artifact `json:"artifacts"`
Commands []CommandResult `json:"commands"`
}
FlowResult is the engine-neutral report shape for one executed flow.
func FromEngineFlowResult ¶
func FromEngineFlowResult(result engine.FlowResult, config model.Config) (FlowResult, error)
FromEngineFlowResult converts one immutable engine result into the report v1 DTO without transferring ownership of engine state.
type HTMLOptions ¶
type HTMLOptions struct {
// SuiteName titles the report. Blank falls back to a generic title.
SuiteName string
// Timestamp is the run's own notion of now. Taken from the caller for the
// same reason JUnitOptions takes one: two identical runs must render
// identical bytes.
Timestamp time.Time
// Detailed selects HTML-DETAILED, which lists each flow's steps. The step
// list is the whole difference between the two formats.
Detailed bool
}
HTMLOptions configures one rendered report.
type JUnitOptions ¶
type JUnitOptions struct {
SuiteName string
// Device names the device the suite ran on. Empty omits the attribute rather
// than inventing a value the host did not request from the driver.
Device string
Timestamp time.Time
}
JUnitOptions supplies suite-level values that must remain fixed across repeated renders. MarshalJUnit never reads the wall clock.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer owns report files beneath one injected output root. It records a file only after the write succeeds, and all returned paths are relative to root.
func (*Writer) RegisterArtifact ¶
RegisterArtifact records an already-finalized regular file beneath the output root without rewriting it.
func (*Writer) WriteArtifact ¶
WriteArtifact writes arbitrary writer-owned bytes beneath the output root and records the resulting artifact for the manifest.
func (*Writer) WriteCommands ¶
func (writer *Writer) WriteCommands(flow FlowResult) (Artifact, error)
WriteCommands creates <sanitized-flow>/commands.json.
func (*Writer) WriteFailureScreenshot ¶
func (writer *Writer) WriteFailureScreenshot(flowName string, sequence int64, data []byte) (Artifact, error)
WriteFailureScreenshot writes the provided bytes unchanged.
func (*Writer) WriteJUnit ¶
func (writer *Writer) WriteJUnit(options JUnitOptions, flows []FlowResult) (Artifact, error)
WriteJUnit creates the suite-wide junit.xml artifact.
func (*Writer) WriteManifest ¶
WriteManifest creates artifacts.json from writer-created files that still exist as regular files. The manifest intentionally does not list itself.