Skip to main content

Test Impact Analysis for C# / .NET and Java — selects only tests affected by a git diff. Node.js support coming soon.

Project description

opentia — Test Impact Analysis

Analyses a git diff and selects only the tests whose execution path could have been affected by the change. Skips the full suite on every push.

No external dependencies — Python 3.8+ stdlib only.

Language support: C# / .NET and Java (Maven / Gradle).


Requirements

Tool Version Purpose
Python 3.8+ Run opentia
Git any Diff source

Installation

pip install opentia

This installs the opentia command on your PATH.


Quick start

# Analyse the last commit
opentia --base HEAD~1 --root <path-to-your-project>

# Analyse uncommitted (staged + unstaged) changes — no commit needed
opentia --unstaged --root <path-to-your-project>

# Analyse and immediately run the selected tests
opentia --base HEAD~1 --root <path-to-your-project> --run

--root is where your .sln / .csproj / pom.xml / build.gradle files live. It does not need to be the git root — opentia locates the actual git root automatically.


Usage reference

opentia [OPTIONS] [-- TEST_ARGS]

  --base REF      Git ref to diff against (e.g. HEAD~1, main, origin/main)
  --head REF      Head ref to diff from (default: HEAD)
  --root DIR      Directory containing project files (default: .)
  --strategy      project | convention | symbol | hybrid (default: hybrid)
  --output, -o    human | json | github-actions | azure-devops (default: human)
  --run           Execute the test command after analysis
  --unstaged      Analyse working-tree changes instead of a git diff
  --              Everything after this is forwarded to the test runner

Output formats

# Human-readable (default)
opentia --base HEAD~1 --root .

# JSON — pipe into scripts or CI steps
opentia --base HEAD~1 --root . --output json

# GitHub Actions
opentia --base HEAD~1 --root . --output github-actions

# Azure DevOps
opentia --base HEAD~1 --root . --output azure-devops

JSON output fields

{
  "run_all": false,               // true = targeted selection was abandoned
  "test_filter": "FullyQualifiedName~PricingServiceTests",
  "test_project_paths": ["...SampleApp.Services.Tests.csproj"],
  "affected_test_projects": ["SampleApp.Services.Tests"],
  "affected_test_classes": ["PricingServiceTests"],
  "test_command": "dotnet test \"...\" --filter \"...\"",
  "reason": "Analysis complete",
  "strategy_notes": []            // warnings / fallback explanations
}

CI integration

GitHub Actions — pull request

on:
  pull_request:
    branches: [main, staging]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Test Impact Analysis
        id: tia
        run: opentia --base ${{ github.event.pull_request.base.sha }} --root . --output github-actions

      - name: Run affected tests
        if: steps.tia.outputs.has_tests == 'true'
        run: ${{ steps.tia.outputs.test_command }}

Available outputs: test_filter, run_all, has_tests, test_project_paths, test_command.

GitHub Actions — push to branch

- name: Test Impact Analysis
  id: tia
  run: opentia --base ${{ github.event.before }} --root . --output github-actions

- name: Run affected tests
  if: steps.tia.outputs.has_tests == 'true'
  run: ${{ steps.tia.outputs.test_command }}

Azure DevOps

- script: opentia --base $(System.PullRequest.TargetBranchName) --root . --output azure-devops
  displayName: Test Impact Analysis

- script: $(testCommand)
  condition: eq(variables['hasTests'], 'true')
  displayName: Run affected tests

Available variables: testFilter, runAllTests, hasTests, testProjectPaths, testCommand.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opentia-1.0.4.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opentia-1.0.4-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file opentia-1.0.4.tar.gz.

File metadata

  • Download URL: opentia-1.0.4.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for opentia-1.0.4.tar.gz
Algorithm Hash digest
SHA256 e2400333392a6342c49cabb8eed70b2d4d30bddc9fb8848c2175c7fef187c8ad
MD5 33fba1cde26cddcac8a408787084fede
BLAKE2b-256 8f13dcd98f9d33e8fb32eb4caf07ae4f7d1cf5b73d2922ef566f9e8a9e7dd237

See more details on using hashes here.

File details

Details for the file opentia-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: opentia-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for opentia-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a482afd28afd1aedb1b9ba0f18d0a92f182a4df6a60608478f1c1ac53a160c07
MD5 15ac95d2f7663d37f368d4588020c0cc
BLAKE2b-256 0ddbe2c6244c0540643f8cbaaed2b6c1176bbede0f8f8f72243dbb50be79ebcc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page