< Summary - Neospec Coverage

Information
Class: TestStatus
Assembly: domain
File(s): /home/runner/work/neospec/neospec/internal/domain/result.go
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
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
String0%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
 516func (s TestStatus) String() string {
 517  switch s {
 118  case StatusPass:
 119    return "pass"
 120  case StatusFail:
 121    return "fail"
 122  case StatusSkip:
 123    return "skip"
 124  case StatusError:
 125    return "error"
 126  default:
 127    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.
 50func (s *SuiteResult) Counts() (pass, fail, skip, errors int) {
 51  for _, t := range s.Tests {
 52    switch t.Status {
 53    case StatusPass:
 54      pass++
 55    case StatusFail:
 56      fail++
 57    case StatusSkip:
 58      skip++
 59    case StatusError:
 60      errors++
 61    }
 62  }
 63  return
 64}
 65
 66// Passed reports whether the suite has no failures or errors.
 67func (s *SuiteResult) Passed() bool {
 68  _, fail, _, errors := s.Counts()
 69  return fail == 0 && errors == 0
 70}

Methods/Properties

String