Skip to content

Commit

Permalink
Add Finding and its associated types.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Nov 23, 2020
1 parent f6e4026 commit ef705ac
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
12 changes: 12 additions & 0 deletions report/builder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package report

// Builder is a utility for constructing test reprots.
type Builder struct {
Log func(string)
}

func (b *Builder) AddFinding(f Finding) {
}

func (b *Builder) Finalize() {
}
51 changes: 51 additions & 0 deletions report/finding.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package report

// A Finding is a piece of information discovered by observing the engine
// throughout the lifetime of a test.
type Finding struct {
// Caption is a brief sentence describing the finding.
//
// It must not be empty.
//
// If the Finding is a result of an Expectation the caption should be
// phrased in terms of the expectation and not the cause of the
// expectation's passing or failing.
//
// For example, use "the expected DepositSubmitted event was not recorded"
// in preference to "no handlers produce DepositSubmitted events".
Caption string

// Summary is a brief paragraph describing the finding.
//
// It may be empty.
//
// If the Finding is a result of a failed Expectation the summary should
// give the best explanation as to why the failure occurred.
//
// For example, use "the handler that records this event has been disabled"
// in preference to "the expected event was not recorded".
Summary string

// Polarity indicates how the finding influenced test result, if at all.
Polarity FindingPolarity

// Evidence contains other findings that led to this finding.
Evidence []Finding
}

// FindingPolarity is an numerations of the "polarity" of a finding, which
// describes the effect of the finding on the result of a test.
type FindingPolarity int

const (
// Negative indicates that the finding caused the test to fail. Typically
// this would take precedence over any Positive finding.
Negative FindingPolarity = -1

// Neutral indicates the the finding did not effect the test result.
Neutral FindingPolarity = -0

// Positive indicates that the finding caused the test to pass, assuming no
// Negative findings were discovered.
Positive FindingPolarity = +1
)

0 comments on commit ef705ac

Please sign in to comment.