About Coverage

Learn what code coverage is, why it matters, and how to generate coverage files that Nanovision can read.

Already collecting coverage?

If you already generate coverage reports, you can skip the theory and move straight to Getting Started.

Go to Getting Started

Why Code Coverage Matters

Confidence in Refactoring

High coverage gives you the safety net to refactor legacy code without fear of breaking hidden functionality.

Dead Code Elimination

Identify parts of your codebase that are never executed, helping you keep your project lean and maintainable.

Quality Gate

Enforce minimum coverage standards in your CI/CD pipeline to prevent technical debt from accumulating.

Test Effectiveness

Coverage is not just about quantity. It highlights logical branches and edge cases your tests might be missing.

Generating Coverage Files

Go (Golang)

Native support built into the toolchain.

Official Docs

Simply pass the -coverprofile flag when running your tests to generate the required file.

go test ./... -coverprofile=coverage.out

Diff Support

Nanovision can add extra information to the report if it knows what changed. To do this, you must provide a unified diff file.

Git
Docs

Generate a diff between your branch and the target branch (e.g., main).

git diff origin/main...HEAD > changes.diff
Perforce
Docs

Generate a unified diff for your pending changelist.

p4 diff -du > changes.diff

Have your files ready?

Go to Getting Started to install Nanovision and run your first report.