testmap

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package testmap provides test coverage mapping between specs and code.

This package analyzes test coverage data and maps it to specification requirements, helping identify which requirements have adequate test coverage and which need additional testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoverageMapping

type CoverageMapping struct {
	Project      string             `json:"project"`
	GeneratedAt  time.Time          `json:"generated_at"`
	Requirements []RequirementCover `json:"requirements"`
	Tests        []TestInfo         `json:"tests"`
	Summary      CoverageSummary    `json:"summary"`
	Unmapped     UnmappedItems      `json:"unmapped"`
}

CoverageMapping represents the relationship between specs and tests.

func (*CoverageMapping) ExportJSON

func (cm *CoverageMapping) ExportJSON() ([]byte, error)

ExportJSON exports the coverage mapping as JSON.

func (*CoverageMapping) RenderMarkdown

func (cm *CoverageMapping) RenderMarkdown() string

RenderMarkdown outputs the coverage mapping as Markdown.

type CoverageSummary

type CoverageSummary struct {
	TotalRequirements     int     `json:"total_requirements"`
	CoveredRequirements   int     `json:"covered_requirements"`
	PartialRequirements   int     `json:"partial_requirements"`
	UncoveredRequirements int     `json:"uncovered_requirements"`
	TotalTests            int     `json:"total_tests"`
	MappedTests           int     `json:"mapped_tests"`
	OverallCoverage       float64 `json:"overall_coverage"` // 0-100
}

CoverageSummary provides aggregate coverage statistics.

type Mapper

type Mapper struct {
	// contains filtered or unexported fields
}

Mapper performs test coverage mapping.

func NewMapper

func NewMapper(projectPath string) *Mapper

NewMapper creates a new test coverage mapper.

func (*Mapper) Map

func (m *Mapper) Map() (*CoverageMapping, error)

Map generates a coverage mapping from specs and tests.

func (*Mapper) WithSpecPatterns

func (m *Mapper) WithSpecPatterns(patterns []string) *Mapper

WithSpecPatterns sets custom spec file patterns.

func (*Mapper) WithTestPatterns

func (m *Mapper) WithTestPatterns(patterns []string) *Mapper

WithTestPatterns sets custom test file patterns.

type RequirementCover

type RequirementCover struct {
	ID          string   `json:"id"`
	Title       string   `json:"title"`
	SpecFile    string   `json:"spec_file"`
	SpecSection string   `json:"spec_section,omitempty"`
	Tests       []string `json:"tests,omitempty"`      // Test function names
	TestFiles   []string `json:"test_files,omitempty"` // Test file paths
	Coverage    float64  `json:"coverage"`             // 0-100
	Status      string   `json:"status"`               // covered, partial, uncovered
	Priority    string   `json:"priority,omitempty"`
}

RequirementCover shows test coverage for a requirement.

type TestInfo

type TestInfo struct {
	Name         string   `json:"name"`
	File         string   `json:"file"`
	Package      string   `json:"package,omitempty"`
	Requirements []string `json:"requirements,omitempty"` // Requirement IDs this test covers
	Passed       bool     `json:"passed"`
	Duration     float64  `json:"duration_ms,omitempty"`
}

TestInfo contains information about a test.

type UnmappedItems

type UnmappedItems struct {
	Requirements []string `json:"requirements,omitempty"` // Requirements without tests
	Tests        []string `json:"tests,omitempty"`        // Tests without requirement refs
}

UnmappedItems tracks items without proper mapping.

Jump to

Keyboard shortcuts

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