spotlight

package
v0.166.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reporter

type Reporter struct {
	TestResults []report.TestResult
	Dst         io.Writer
	// contains filtered or unexported fields
}

Reporter implements report.Reporter and highlights the most important test results.

func (*Reporter) Add

func (r *Reporter) Add(t report.TestResult)

Add adds the test result that can be rendered by Render.

func (*Reporter) ArtifactRequirements

func (r *Reporter) ArtifactRequirements() []report.ArtifactType

ArtifactRequirements returns a list of artifact types this reporter requires to create a proper report.

func (*Reporter) Render

func (r *Reporter) Render()

Render renders out a test summary.

Example
startTime := time.Now()
restResults := []report.TestResult{
	{
		Name:      "Chrome",
		Duration:  171452 * time.Millisecond,
		StartTime: startTime,
		EndTime:   startTime.Add(171452 * time.Millisecond),
		Status:    job.StateFailed,
		Browser:   "Chrome",
		Platform:  "Windows 10",
		URL:       "https://app.saucelabs.com/tests/1234567890abcdef",
		Attempts: []report.Attempt{
			{
				Status: job.StateFailed,
				TestSuites: junit.TestSuites{
					TestSuites: []junit.TestSuite{
						{
							Name: "",
							TestCases: []junit.TestCase{
								{
									Name:      "TestCase1",
									ClassName: "com.saucelabs.examples.SauceTest",
									Error: &junit.Error{
										Message: "Whoops!",
										Type:    "AssertionError",
									},
								},
							},
						},
					},
				},
			},
		},
	},
}

r := Reporter{
	Dst: os.Stdout,
}

for _, tr := range restResults {
	r.Add(tr)
}

r.Render()
Output:

Spotlight:

 ✖ Chrome
   ● URL: https://app.saucelabs.com/tests/1234567890abcdef
   ● Failed Tests: (showing max. 5)
     ✖ com.saucelabs.examples.SauceTest › TestCase1

func (*Reporter) Reset

func (r *Reporter) Reset()

Reset resets the reporter to its initial state. This action will delete all test results.

Jump to

Keyboard shortcuts

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