report

package
v1.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CucumberReport added in v1.4.0

type CucumberReport struct {
	Features        []CukeFeature
	ProjectName     string
	AppVersion      string
	Environment     string
	Browser         string
	Platform        string
	RunTime         time.Duration
	OS              string
	Timestamp       string
	ElementsPassed  int
	ElementsFailed  int
	ElementsPending int
	StepsPassed     int
	StepsFailed     int
	StepsPending    int
	StepsSkipped    int
	TotalElements   int
	TotalSteps      int
	// contains filtered or unexported fields
}

CucumberReport holds the jsonResults of a test execution

func NewCucumberReport added in v1.4.0

func NewCucumberReport(s *config.Settings) CucumberReport

NewCucumberReport creates a new CucumberReport struct and initializes it.

func (*CucumberReport) UnmarshallJSON added in v1.4.0

func (r *CucumberReport) UnmarshallJSON(jsonResults []byte) error

UnmarshallJSON unmarshalls JSON content into an array of CukeFeatures.

type CukeComment added in v1.4.0

type CukeComment struct {
	Value string `json:"value"`
	Line  int    `json:"line"`
}

CukeComment is any single-line comment.

type CukeDataTableRow added in v1.4.0

type CukeDataTableRow struct {
	Cells []string `json:"cells"`
}

CukeDataTableRow represents a row in a DataTable owned by a step

type CukeDocstring added in v1.4.0

type CukeDocstring struct {
	Value       string `json:"value"`
	ContentType string `json:"content_type"`
	Line        int    `json:"line"`
}

CukeDocstring is a docstring (multi-line comment).

type CukeElement added in v1.4.0

type CukeElement struct {
	ID           string     `json:"id"`
	Keyword      string     `json:"keyword"`
	Name         string     `json:"name"`
	Description  string     `json:"description"`
	Line         int        `json:"line"`
	Type         string     `json:"type"`
	Tags         []CukeTag  `json:"tags,omitempty"`
	Steps        []CukeStep `json:"steps,omitempty"`
	StepsPassed  int        `json:"-"`
	StepsFailed  int        `json:"-"`
	StepsPending int        `json:"-"`
	StepsSkipped int        `json:"-"`
}

CukeElement represents any block nested within a Feature:

  • Background
  • Scenario
  • Scneario Outline

func (*CukeElement) GetTrimmedDescription added in v1.4.0

func (e *CukeElement) GetTrimmedDescription() string

GetTrimmedDescription removes leading and trailing whitespace from the Scenario's description and returns the result.

func (*CukeElement) GetTrimmedKeyword added in v1.4.0

func (e *CukeElement) GetTrimmedKeyword() string

GetTrimmedKeyword removes leading and trailing whitespace from the Scenario's keyword.

type CukeEmbedding added in v1.4.0

type CukeEmbedding struct {
	MimeType string `json:"mime_type"`
	Data     string `json:"data"`
}

CukeEmbedding is any file or binary content attached to a step.

type CukeFeature added in v1.4.0

type CukeFeature struct {
	URI             string        `json:"uri"`
	ID              string        `json:"id"`
	Keyword         string        `json:"keyword"`
	Name            string        `json:"name"`
	Description     string        `json:"description"`
	Line            int           `json:"line"`
	Comments        []CukeComment `json:"comments,omitempty"`
	Tags            []CukeTag     `json:"tags,omitempty"`
	Elements        []CukeElement `json:"elements,omitempty"`
	ElementsPassed  int           `json:"-"`
	ElementsFailed  int           `json:"-"`
	ElementsPending int           `json:"-"`
	StepsPassed     int           `json:"-"`
	StepsFailed     int           `json:"-"`
	StepsPending    int           `json:"-"`
	StepsSkipped    int           `json:"-"`
}

CukeFeature is a single feature in JSONReport.

func (*CukeFeature) GetTrimmedDescription added in v1.4.0

func (f *CukeFeature) GetTrimmedDescription() string

GetTrimmedDescription returns the features description after removing leading and trailing whitespace from each line.

type CukeMatch added in v1.4.0

type CukeMatch struct {
	Location string `json:"location"`
}

CukeMatch is the method matched to a step.

type CukeResult added in v1.4.0

type CukeResult struct {
	Status   string `json:"status"`
	Error    string `json:"error_message,omitempty"`
	Duration *int   `json:"duration,omitempty"`
}

CukeResult is the result of executing a step.

func (*CukeResult) GetDurationInSeconds added in v1.4.0

func (r *CukeResult) GetDurationInSeconds() string

GetDurationInSeconds convers the millisecond representation of duration to seconds (accurate to 2 decimal places) and returns the result.

type CukeStep added in v1.4.0

type CukeStep struct {
	Keyword    string              `json:"keyword"`
	Name       string              `json:"name"`
	Line       int                 `json:"line"`
	Docstring  *CukeDocstring      `json:"doc_string,omitempty"`
	Match      CukeMatch           `json:"match"`
	Result     CukeResult          `json:"result"`
	Embeddings []*CukeEmbedding    `json:"embeddings,omitempty"`
	DataTable  []*CukeDataTableRow `json:"rows,omitempty"`
}

CukeStep is a single step in a cukeElement.

func (*CukeStep) GetTrimmedKeyword added in v1.4.0

func (s *CukeStep) GetTrimmedKeyword() string

GetTrimmedKeyword removes leading and trailing whitespace from the Step's keyword.

func (*CukeStep) GetTrimmedName added in v1.4.0

func (s *CukeStep) GetTrimmedName() string

GetTrimmedName removes leading and trailing whitespace from the Step's name.

type CukeTag added in v1.4.0

type CukeTag struct {
	Name string `json:"name"`
	Line int    `json:"line"`
}

CukeTag is any tag added to a feature or scenario.

type FileWriteThroughReport

type FileWriteThroughReport struct {
	// contains filtered or unexported fields
}

FileWriteThroughReport is an empty struct that serves to pass GoDog's writes directly to a file.

func (*FileWriteThroughReport) Process

func (s *FileWriteThroughReport) Process() error

Process does nothing here. It simply implements the Report interface.

func (*FileWriteThroughReport) Write

func (s *FileWriteThroughReport) Write(b []byte) (int, error)

type HTMLReport

type HTMLReport struct {
	CucumberReport
	// contains filtered or unexported fields
}

HTMLReport holds the jsonResults of a test execution

func (*HTMLReport) Process

func (r *HTMLReport) Process() error

Process marshalls the `jsonResults` into structs and analyzes the results to generate metrics such as `StepsPassed`, `StepsFailed`, etc.

func (*HTMLReport) Write

func (r *HTMLReport) Write(p []byte) (int, error)

Write implements the io.Writer interface for the JSONReport struct. This allows JSONReport to be the Output stream for GoDog.

type Report

type Report interface {
	Write(p []byte) (int, error)
	Process() error
}

Report is a struct that receives data from GoDog via the `Write` method. Depending on the report type, it will either pass through the data to its final destination or cache it, format it, and then write it out when the Process() method is called.

func NewReport

func NewReport(s *config.Settings) Report

NewReport is a factory method that creates the appropriate `Report` object based on the system's settings.

type StdOutWriteThroughReport

type StdOutWriteThroughReport struct{}

StdOutWriteThroughReport is an empty struct that serves to pass GoDog's writes directly to StdOut.

func (*StdOutWriteThroughReport) Process

func (s *StdOutWriteThroughReport) Process() error

Process does nothing here. It simply implements the Report interface.

func (*StdOutWriteThroughReport) Write

func (s *StdOutWriteThroughReport) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL