tap13

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 4 Imported by: 3

README

tap13

GoDoc

This pacakge implements a parser for the Test Anything Protocol (TAP) version 13 specification.

The full protocol specification can be found at the following URL:

https://testanything.org/tap-version-13-specification.html

This package is intended to allow the results of a TAP test run to be converted to a more useful format for storage and analysis.

Usage as a Library

Given a []string containing TAP v13 output, users can call the Parse() method to return a Results struct. A Stringer interface is implemented on the Results object in order to provide a summary of the test run.

Usage as a command-line tool

A tap13 command-line tool is provided. It will read the contents of each file (assumed to contain TAP version 13 results) specified as an argument, and output a summary of the test results.

This tool is primarily intended for testing the library itself; users of this library should consume the Results and Test structs.

Bugs

Bugs are tracked on the GitHub issues page.

Contributing

Pull requests are welcome! Any additional code must be backward compatible, and covered appropriately by test cases.

Documentation

Overview

Package tap13 implements a parser for the Test Anything Protocol (TAP) version 13 specification.

The full protocol specification can be found at the following URL:

https://testanything.org/tap-version-13-specification.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Results

type Results struct {
	ExpectedTests int
	TotalTests    int
	PassedTests   int
	FailedTests   int
	SkippedTests  int
	TodoTests     int
	TapVersion    int
	BailOut       bool
	BailOutReason string
	FoundTapData  bool
	Tests         []Test
	Lines         []string
	Explanation   []string
}

Results encapsulates the result of the entire test run. If a plan was given in the input TAP, the ExpectedTests will be greater than or equal to zero. The input lines are preserved in the Lines field. Any diagnostics given before the output of a test run is preserved in the Explanation. The Tests field contains a Test struct for each test that was run, in the order that it appeared in the TAP output.

func Parse

func Parse(lines []string) *Results

Parse interprets the specified lines as output lines from a program that generate TAP output, and returns a corresponding Results structure containing the test results based on its interpretation.

func (*Results) IsPassing

func (r *Results) IsPassing() bool

IsPassing checks if the test results should be considered passing (true) or failing (false).

func (*Results) String

func (r *Results) String() string

type Test

type Test struct {
	TestNumber    int
	Passed        bool
	Failed        bool
	Skipped       bool
	Todo          bool
	Description   string
	DirectiveText string
	Diagnostics   []string
	YamlBytes     []byte
}

Test encapsulates the result of a specific test, including a description and diagnostics (if supplied). The TestNumber field is undefined if the TAP output does not include test numbers. Diagnostics are supplied with trimmed whitespace, and blank lines removed.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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