@@ -207,7 +207,7 @@ class SarifReport(
207207
208208 // prepending stack trace by `method` call in generated tests
209209 val methodCallLocation: SarifPhysicalLocation ? =
210- findMethodCallInTestBody(utExecution.testMethodName, method.name)
210+ findMethodCallInTestBody(utExecution.testMethodName, method.name, utExecution )
211211 if (methodCallLocation != null ) {
212212 val testFileName = sourceFinding.testsRelativePath.toPath().fileName
213213 val testClassName = testFileName.nameWithoutExtension
@@ -255,9 +255,15 @@ class SarifReport(
255255 generatedTestsCode.split(' \n ' )
256256 }
257257
258- private fun findMethodCallInTestBody (testMethodName : String? , methodName : String ): SarifPhysicalLocation ? {
258+ private fun findMethodCallInTestBody (
259+ testMethodName : String? ,
260+ methodName : String ,
261+ utExecution : UtExecution ,
262+ ): SarifPhysicalLocation ? {
259263 if (testMethodName == null )
260264 return null
265+ if (utExecution.result is UtSandboxFailure ) // if there is no method call in test
266+ return getRelatedLocations(utExecution).firstOrNull()?.physicalLocation
261267
262268 // searching needed test
263269 val testMethodStartsAt = testsBodyLines.indexOfFirst { line ->
@@ -342,6 +348,7 @@ class SarifReport(
342348 val implicitlyThrown = result is UtImplicitlyThrownException
343349 val overflowFailure = result is UtOverflowFailure && UtSettings .treatOverflowAsError
344350 val assertionError = result is UtExplicitlyThrownException && result.exception is AssertionError
345- return implicitlyThrown || overflowFailure || assertionError
351+ val sandboxFailure = result is UtSandboxFailure
352+ return implicitlyThrown || overflowFailure || assertionError || sandboxFailure
346353 }
347354}
0 commit comments