Loading...
Loading...
MANDATORY for static requests to find, identify, or list untested source files or modules, sources without tests, source-to-test pairing, test-gap worklists, or suggested test locations. Invoke even for a tiny package; do not substitute manual globbing. Uses Roslyn for C#/.NET and tree-sitter for Python, TS/JS, Go, Java, Rust, and Ruby. DO NOT USE FOR: line/branch coverage, CRAP risk, or grading existing tests.
npx skill4agent add dotnet/skills find-untested-sourcesWhich source files have no test file referencing any of their declared types/symbols?
| Engine | Script | Use when |
|---|---|---|
| Roslyn (C#) | | The repo is .NET-only. Parses every |
| tree-sitter (polyglot) | | The repo is not exclusively C#, or you want one tool across Python, TypeScript/JavaScript, Go, Java, Rust, Ruby, and C#. |
--include-testedcoverage-analysiscoverage-analysistest-gap-analysisassertion-qualitydotnet run script.csglobal.jsonMicrosoft.CodeAnalysis.CSharp# From the skill folder
dotnet run scripts/Find-UntestedSources.cs -- <repo-root> [--top N]
# Save the report
dotnet run scripts/Find-UntestedSources.cs -- <repo-root> > pairing.json
# Iterate the untested list, highest-API-surface first
$report = Get-Content pairing.json | ConvertFrom-Json
$report.untested | Select-Object -First 10 source, decl_count, suggested_test_path{
"repo": "<absolute path>",
"elapsed_ms": 8883,
"counts": {
"source_files": 3036,
"test_files": 867,
"untested_files": 1852,
"paired_files": 1184
},
"untested": [
{
"source": "src/Foo/Bar.cs",
"decl_count": 8, // # of type declarations in the file
"suggested_test_path": // mirror of source under a discovered test project
"tests/Foo.Tests/Bar/BarTests.cs"
}
],
"source_to_tests": {
"src/Foo/Baz.cs": [
"tests/Foo.Tests/BazTests.cs",
"tests/Foo.IntegrationTests/Scenarios/BazScenarios.cs"
]
}
}bin/obj/node_modules/.git/.vs/packages/.g.cs.Designer.cs.AssemblyInfo.cs.csproj.Tests.Test.UnitTests.IntegrationTests.E2E.EndToEnd.Spec.SpecsMicrosoft.NET.Test.SdkMSTest.SdkMicrosoft.Testing.PlatformxunitNUnitTUnit<IsTestProject>true</IsTestProject>CSharpSyntaxTree.ParseTextBaseTypeDeclarationSyntaxDelegateDeclarationSyntax(ShortName, EnclosingNamespace, FilePath)usingIdentifierTokenusingSettingsContextsource → [tests]<ProjectReference>pip install tree-sitter-language-packprocess()# From the skill folder
python scripts/find_untested_sources.py <repo-root>
# Restrict to a language (repeatable)
python scripts/find_untested_sources.py <repo-root> --lang python --lang typescript
# Truncate the report (top 20 by declared API surface)
python scripts/find_untested_sources.py <repo-root> --limit-untested 20 > pairing.json
# Iterate, highest-API-surface first
$report = Get-Content pairing.json | ConvertFrom-Json
$report.untested_sources | Select-Object -First 10 path, declaration_count, suggested_test_path--include-testedtested_sources{
"repo_root": "<absolute path>",
"summary": {
"source_files": 3138,
"test_files": 761,
"tested_source_files": 1419,
"untested_source_files": 1719,
"orphan_test_files": 15,
"languages": ["csharp"]
},
"untested_sources": [
{
"path": "src/Foo/Bar.cs",
"language": "csharp",
"declaration_count": 8,
"declarations": ["Bar", "BarOptions", "IBar", "..."],
"suggested_test_path": "src/Foo/BarTests.cs"
}
],
"orphan_tests": [
{ "path": "tests/SomeIntegrationTest.cs", "language": "csharp" }
]
}binobjnode_modulestargetdistbuildvendor__pycache__.venv.git.d.ts.g.cs.Designer.cs_pb2.py*.min.jsAssemblyInfo.csdetect_language_from_path| Language | Test rule |
|---|---|
| Python | path contains |
| JS/TS/TSX | path contains |
| Go | filename ends |
| Java | path contains |
| Rust | path contains |
| C# | path contains |
| Ruby | path contains |
process(text, ProcessConfig(structure, imports, symbols))from pkg.mod import xpkg/mod.pyimport a.b.C;a/b/C.javausinguntested_sourcesvarnew()iddbTagcoverage-analysisuntested[*].sourceuntested_sources[*].path*.suggested_test_path<ProjectReference>dotnet sln addsource_to_tests--include-testedtested_sourcesorphan_tests