-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
I want to extract all unit test methods (Junit 4 or 5) and the corresponding methods that they test. I want to learn how to write a query for this.
Based on my current knowledge, I can do a from Call call and then add some heuristic-based checks on call.getCallee() and call.getCaller().
For example:
/**
* @name Call graph
* @description Call graph.
* @kind problem
* @id java/call-graph
* @tags testability
*/
import java
// Track calls from test methods to other methods within the codebase.
from Call call
where call.getCaller().getName().matches("%test%")
select call.getCallee(), "calls", call.getCaller()
I get the following error:
Error was: Expected result pattern(s) are not present for problem query: Expected alternating entity/string and string columns. [INVALID_RESULT_PATTERNS]
What am I doing wrong here? Also, what would be a better way to write this query?