< Summary - Neospec Coverage

Information
Class: SuiteResult
Assembly: domain
File(s): /home/runner/work/neospec/neospec/internal/domain/result.go
Line coverage
100%
Covered lines: 16
Uncovered lines: 0
Coverable lines: 16
Total lines: 70
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Counts0%00100%
Passed0%00100%

File(s)

/home/runner/work/neospec/neospec/internal/domain/result.go

#LineLine coverage
 1package domain
 2
 3import "time"
 4
 5// TestStatus is the outcome of a single test case.
 6type TestStatus int
 7
 8// Test outcome constants.
 9const (
 10  StatusPass TestStatus = iota
 11  StatusFail
 12  StatusSkip
 13  StatusError
 14)
 15
 16func (s TestStatus) String() string {
 17  switch s {
 18  case StatusPass:
 19    return "pass"
 20  case StatusFail:
 21    return "fail"
 22  case StatusSkip:
 23    return "skip"
 24  case StatusError:
 25    return "error"
 26  default:
 27    return "unknown"
 28  }
 29}
 30
 31// TestResult holds the outcome of one `it` block.
 32type TestResult struct {
 33  // Name is the full path of describe/it labels, e.g. "mymodule > behaves correctly".
 34  Name     string
 35  Status   TestStatus
 36  Duration time.Duration
 37  // Output is any text the test wrote to stdout.
 38  Output string
 39  // Error is the failure or error message, empty when Status == StatusPass or StatusSkip.
 40  Error string
 41}
 42
 43// SuiteResult aggregates all test results from a run.
 44type SuiteResult struct {
 45  Tests    []TestResult
 46  Duration time.Duration
 47}
 48
 49// Counts returns the pass, fail, skip, and error counts.
 750func (s *SuiteResult) Counts() (pass, fail, skip, errors int) {
 751  for _, t := range s.Tests {
 1152    switch t.Status {
 553    case StatusPass:
 554      pass++
 255    case StatusFail:
 256      fail++
 257    case StatusSkip:
 258      skip++
 259    case StatusError:
 260      errors++
 61    }
 62  }
 763  return
 64}
 65
 66// Passed reports whether the suite has no failures or errors.
 567func (s *SuiteResult) Passed() bool {
 568  _, fail, _, errors := s.Counts()
 569  return fail == 0 && errors == 0
 570}

Methods/Properties

Counts
Passed