Skip to content
lusipadPublic

About

Test Impact Analysis for Code Coverage

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

TiaCC - Test Impact Analysis for Code Coverage

Self Test Publish Release License Platform

Run Only Affected Tests, Make CI Lightning Fast

Reduce 30-minute full test runs to 5 minutes

Quick Start | How It Works | Dashboard | Docs

简体中文


Sound Familiar?

Pain Point Description
Slow CI Every commit waits 30+ minutes for full test suite
Wasted Resources Changed one line, runs thousands of unrelated tests
Slow Feedback Submit PR, grab coffee, still waiting...
Redundant Work Passed locally, CI runs everything again

How TiaCC Solves This

┌─────────────────────────────────────────────────────────────────────────┐
│                                                                         │
│     Traditional Way                     TiaCC Way                       │
│     ───────────────                     ──────────                       │
│                                                                         │
│     Changed calculator.cpp             Changed calculator.cpp           │
│            ↓                                  ↓                         │
│     Run 1000+ tests                    Smart analysis: Which tests      │
│            ↓                           cover this file?                 │
│     Wait 30 minutes                           ↓                         │
│            ↓                           Recommend only 2 relevant tests  │
│     ...                                       ↓                         │
│                                        Done in 3 minutes!               │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

Core Principle

TiaCC builds source-to-test mappings through code coverage analysis:

1. Nightly Build: Run full test suite, record which tests cover which files
                   ↓
2. Generate Mapping DB: calculator.cpp ← test_calc_basic, test_calc_advanced
                         statistics.cpp  ← test_statistics
                   ↓
3. PR Submission: Detect which files you changed
                   ↓
4. Smart Recommendation: Run only affected tests!

Interactive Dashboard

TiaCC provides a beautiful Web Dashboard to visualize code-test relationships:

  • Dependency graph: visualize source ↔ test relationships
  • File tree & aggregate coverage: find hotspots quickly
  • Search & function-level drill-down: locate key dependencies and low-coverage areas
  • See docs/dashboard.md for details

Quick Start

30-Second Dashboard Demo

# 1. Clone the repo
git clone https://github.com/lusipad/TiaCC.git
cd TiaCC

# 2. Start Dashboard (Blazor)
dotnet run --project src/dashboard/dotnet/TiaCC.Dashboard/TiaCC.Dashboard.csproj -c Release

Using in Your Project

Step 1: Install TiaCC CLI

# Ensure .NET 10 SDK is installed (see global.json)
dotnet --version

# Build TiaCC CLI
dotnet build src/TiaCC.DotNet.sln -c Release

Step 2: Nightly - Build Mapping Database

# 1. Run tests with coverage collection
dotnet test --collect:"XPlat Code Coverage" --results-directory ./coverage

# 2. Initialize database
dotnet run --project src/cli/dotnet/TiaCC.Cli/TiaCC.Cli.csproj -- init --db impact_map.db

# 3. Map coverage data
dotnet run --project src/cli/dotnet/TiaCC.Cli/TiaCC.Cli.csproj -- map \
  --db impact_map.db \
  --coverage ./coverage/*/coverage.cobertura.xml \
  --test MyTestClass

Step 3: PR Time - Get Recommended Tests

# Query affected tests
dotnet run --project src/cli/dotnet/TiaCC.Cli/TiaCC.Cli.csproj -- query \
  --db impact_map.db \
  --files src/MyService.cs

# Example output:
# Affected tests:
#   - MyServiceTests
#   - IntegrationTests

Results Comparison

Metric Traditional With TiaCC
CI Time 30 minutes 3-5 minutes
Tests Run 1000+ 2-10
Developer Feedback 30 min after commit 3 min after commit
Compute Resources 100% 5-10%

Typical Use Cases

Use Case 1: Daily Development

# Modified MathService.cs
git diff --name-only
# → src/MathService.cs

# Query affected tests
dotnet run --project src/cli/dotnet/TiaCC.Cli/TiaCC.Cli.csproj -- query \
  --db impact_map.db \
  --files src/MathService.cs
# → MathServiceTests

# Run only this test
dotnet test --filter "FullyQualifiedName~MathServiceTests"

Use Case 2: CI/CD Integration

# .github/workflows/pr.yml
- name: Get affected tests
  run: |
    dotnet run --project src/cli/dotnet/TiaCC.Cli/TiaCC.Cli.csproj -- query \
      --db impact_map.db \
      --files $(git diff --name-only origin/main) \
      > affected_tests.txt

- name: Run affected tests
  run: |
    FILTER=$(cat affected_tests.txt | tr '\n' '|' | sed 's/|$//')
    dotnet test --filter "FullyQualifiedName~$FILTER"

Use Case 3: Dashboard Analysis

  1. Visual Exploration - Understand code-test dependencies
  2. Function-Level Targeting - Find low-coverage functions
  3. Impact Analysis - See which tests a file change affects

Supported Tech Stack

Type Support
Languages C++ (LLVM), C# (Coverlet/.NET), Java (JaCoCo), Python (coverage.py), Lua (LuaCov)
Coverage Formats LLVM Profile, Coverlet, Cobertura, OpenCppCoverage, LCOV/gcov, JaCoCo, dotCover, LuaCov
Test Frameworks xUnit, NUnit, MSTest, pytest, go test, busted, and more
Platforms Windows, Linux, macOS
Analysis Level File-level, Function-level

Project Structure

TiaCC/
├── global.json          # .NET SDK version
├── scripts/             # Repo scripts (incl. dotnet self-test)
├── src/
│   ├── cli/dotnet/      # .NET CLI (tia-mapper)
│   ├── core/cpp/        # C++ core/coverage collection
│   ├── core/dotnet/     # .NET core library
│   ├── dashboard/dotnet/# Blazor Dashboard
│   ├── collectors/      # Collectors (e.g., coverlet)
│   └── clients/         # Multi-language test framework clients
├── tests/e2e/           # End-to-end verification tests
└── docs/                # Detailed documentation

Documentation

Document Description
Architecture System architecture, data flow, Dashboard features
Integration Guide How to integrate into your project
E2E Tests End-to-end verification tests

Contributing

Contributions welcome! Please read CONTRIBUTING.md to learn how.

License

MIT License - See LICENSE


If TiaCC helped you, please give it a Star!

Made with by the TiaCC Team

About

Test Impact Analysis for Code Coverage

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages