find_affected_tests
Identifies test methods that cover a specified symbol in Java code, helping determine which tests to run after a change.
Instructions
Find the test methods that exercise a symbol, directly or transitively.
USAGE: find_affected_tests(filePath="path/to/File.java", line=10, column=5) OUTPUT: Test methods (JUnit 4/5, TestNG) from which the symbol is reachable, with locations - the set of tests to run after changing it.
The caller walk follows calls, instantiations, field accesses, and override declarations (a test calling through an interface or superclass covers the implementation). Non-test intermediate methods are walked through but not reported. Disabled tests are included with disabled=true (they cover the code but will not run). A symbol no test reaches returns an empty set.
Supports project methods, fields, and types as the target symbol.
Options:
maxResults: cap the reported list (default 100)
Requires load_project to be called first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | File containing the symbol | |
| line | Yes | Zero-based line number | |
| column | Yes | Zero-based column number | |
| maxResults | No | Maximum test methods to return (default 100) |