SMTestLocator - Translate location to PsiElement as soon as tests finish running



I'm writing a Test Runner for mutation testing, where the "test" that I need to locate isn't always an element that's easily described by a function name but rather an element that lives from "line 3, column 3 to line 4, column 5" as an example. I've been able to translate that into a PsiElement inside my SMTestLocator but the problem is that SMTestLocator appears to run when a user tries to jump to that test in the console. If a user has altered the file at all between the test coming back and them trying to click into the test, the line and column locations that the test framework report are now wrong.

Is there a way to translate the location hint into a PsiElement at the time of test reporting rather than at a later point based on user input?


Hi Gareth,

it can't be done by default as it would break laziness of the navigation element calculation. It is extremely important e.g. when you start thousands of tests most of which passes and thus are hidden by default.


You can attach to the `` topic and listen to the `testStarted` message and at that time ask for a location. In many frameworks this is the time when the testProxy is created



Thank you, that's exactly what I was looking for!


Please sign in to leave a comment.