report

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SummaryTemplate = `` /* 1302-byte string literal not displayed */

	JUnitTemplate = `` /* 550-byte string literal not displayed */

	JSONTemplate = `` /* 899-byte string literal not displayed */

)

Variables

View Source
var (
	Command = &cobra.Command{
		Use:   "report",
		Short: "show information about latest test run",
		Long: `show information about latest test run",

The report command shows a summary of the latest test run. The summary includes
information such as a list of tests which did not pass, average run times, CPU
load, etc.
Command line options '--json' and '--junit' show similar output, but with JSON
or JUNIT formatting.

Use environment variable 'NTT_COLORS=never' to disable colors.

Templating
----------

ntt uses the Go templates format which you can use to specify custom output templates.
Example:

	ntt report --template "{{.Name}} took {{.Tests.Duration}}"


Available Objects

  .Report is a collection of test runs
  .Report.Cores:      number of CPU cores
  .Report.Environ:    list of environment variable
  .Report.Getenv:     value of an environment variable
  .Report.LineCount:  number of TTCN-3 source code lines
  .Report.MaxJobs:    maximum number of parallel test jobs
  .Report.MaxLoad:    maximum allowed CPU load
  .Report.Modules:    a list of collection sorted by module
  .Report.Name:       name of the collection
  .Report.Runs:       list of test runs
  .Report.Tests:      list of tests (with final verdict)
  .Report.FixedTests: list of tests where unstable tests are changed to pass or fail (based on ExpectedVerdict)

  .RunSlice is a list of test runs
  .RunSlice.Load:      Return systemload slice for every run
  .RunSlice.Average:   Average duration of runs (median)
  .RunSlice.Deviation: Standard deviation
  .RunSlice.Duration:  Timespan of first and last test run
  .RunSlice.Failed:    A slice of failed test runs (inconc, none, error, fail, ...)
  .RunSlice.First:     First test run
  .RunSlice.Last:      Last test run
  .RunSlice.Longest:   Longest test run
  .RunSlice.NotPassed: A slice of tests without 'pass' verdict
  .RunSlice.Result:    Final result (PASSED, FAILED, UNSTABLE, NOEXEC)
  .RunSlice.Shortest:  Shortest test run
  .RunSlice.Total:     Sum of all test run durations
  .RunSlice.Unstable:  List of unstable test runs

  .Run is a individual test run
  .Run.ID:          test run ID (e.g. test.Stable_A-2)
  .Run.Name:        full qualified test name (test.Stable_A)
  .Run.Instance:    test instance (e.g. 2)
  .Run.Module:      module name (test)
  .Run.Testcase:    testcase name (e.g. Stable_A)
  .Run.Verdict:     the test verdict (pass, fail, none, ...)
  .Run.Begin:       when the test was started (time.Time Go object)
  .Run.End:         when the test ended (time.Time Go object)
  .Run.Duration:    a time.Duration Go object
  .Run.Load:        the system load when the test was started
  .Run.MaxMem:      the maximum memory used when the test ended
  .Run.Reason:      optional reason for verdicts
  .Run.ReasonFiles: content of *.reason files
  .Run.RunnerID:    the ID of the runner exeuting the run
  .Run.WorkingDir:  working Directory of the test

  .File is a (reason) file
  .File.Name:    path to file
  .File.Content: content of file


Additional commands

  green:    output ANSI sequences for color green
  red:      output ANSI sequences for color red
  orange:   output ANSI sequences for color orange
  bold:     output ANSI sequences for bold text
  off:      output ANSI sequences to reset attributes
  colorize: colorize output
  join:     join input with a separator
  json:     encode input using JSON format
  min:      returns the minimum of a float slice
  max:      returns the maximum of a float slice
  median:   returns the median of a float slice



Summary template:
` + SummaryTemplate + `


JUnit template:
` + JUnitTemplate + `


JSON template:
` + JSONTemplate + `


`,
		RunE: report,
	}
)

Functions

func ReportTemplate added in v0.11.0

func ReportTemplate(w io.Writer, suite *ntt.Suite, text string) error

Types

type Collection

type Collection struct {
	Name string
	// contains filtered or unexported fields
}

func NewCollection

func NewCollection(name string, runs ...results.Run) *Collection

func (Collection) FixedTests added in v0.8.0

func (c Collection) FixedTests() RunSlice

func (Collection) Modules

func (c Collection) Modules() []*Collection

func (Collection) Runs

func (c Collection) Runs() RunSlice

func (Collection) Tests

func (c Collection) Tests() RunSlice

type File

type File struct {
	Name    string
	Content string
}

type Report

type Report struct {
	Collection

	Cores int
	// contains filtered or unexported fields
}

func NewReport

func NewReport(suite *ntt.Suite) (*Report, error)

func (*Report) Environ

func (r *Report) Environ() []string

func (*Report) Getenv

func (r *Report) Getenv(s string) string

func (*Report) LineCount

func (r *Report) LineCount() (int, error)

func (*Report) MaxJobs

func (r *Report) MaxJobs() int

func (*Report) MaxLoad

func (r *Report) MaxLoad() int

type Run

type Run struct{ results.Run }

func (Run) Module

func (r Run) Module() string

func (Run) ReasonFiles

func (r Run) ReasonFiles() ([]File, error)

func (Run) Testcase

func (r Run) Testcase() string

type RunSlice

type RunSlice []Run

func NewRunSlice

func NewRunSlice(runs []results.Run) RunSlice

func (RunSlice) Average

func (rs RunSlice) Average() time.Duration

func (RunSlice) Deviation

func (rs RunSlice) Deviation() time.Duration

func (RunSlice) Duration

func (rs RunSlice) Duration() time.Duration

func (RunSlice) Failed

func (rs RunSlice) Failed() []Run

func (RunSlice) First

func (rs RunSlice) First() Run

func (RunSlice) Last

func (rs RunSlice) Last() Run

func (RunSlice) Load

func (rs RunSlice) Load() []float64

func (RunSlice) Longest

func (rs RunSlice) Longest() Run

func (RunSlice) NotPassed

func (rs RunSlice) NotPassed() []Run

func (RunSlice) Result

func (rs RunSlice) Result() string

func (RunSlice) Shortest

func (rs RunSlice) Shortest() Run

func (RunSlice) Total

func (rs RunSlice) Total() time.Duration

func (RunSlice) Unstable

func (rs RunSlice) Unstable() []Run

Jump to

Keyboard shortcuts

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