leakcanary-android-instrumentation / leakcanary / FailTestOnLeakRunListener
open class FailTestOnLeakRunListener : RunListener
A JUnit RunListener that uses InstrumentationLeakDetector to detect memory leaks in Android instrumentation tests. It waits for the end of a test, and if the test succeeds then it will look for retained objects, trigger a heap dump if needed and perform an analysis.
FailTestOnLeakRunListener can be subclassed to override skipLeakDetectionReason and onAnalysisPerformed
See Also
Name | Summary |
---|---|
<init> | FailTestOnLeakRunListener() A JUnit RunListener that uses InstrumentationLeakDetector to detect memory leaks in Android instrumentation tests. It waits for the end of a test, and if the test succeeds then it will look for retained objects, trigger a heap dump if needed and perform an analysis. |
Name | Summary |
---|---|
failTest | fun failTest(trace: String ): Unit Reports that the test has failed, with the provided trace. |
onAnalysisPerformed | open fun onAnalysisPerformed(heapAnalysis: HeapAnalysis): Unit Called when a heap analysis has been performed and a result is available. |
skipLeakDetectionReason | open fun skipLeakDetectionReason(description: Description): String ? Can be overridden to skip leak detection based on the description provided when a test is started. Return null to continue leak detection, or a string describing the reason for skipping otherwise. |
testAssumptionFailure | open fun testAssumptionFailure(failure: Failure): Unit |
testFailure | open fun testFailure(failure: Failure): Unit |
testFinished | open fun testFinished(description: Description): Unit |
testIgnored | open fun testIgnored(description: Description): Unit |
testRunFinished | open fun testRunFinished(result: Result): Unit |
testRunStarted | open fun testRunStarted(description: Description): Unit |
testStarted | open fun testStarted(description: Description): Unit |
Name | Summary |
---|---|
FailAnnotatedTestOnLeakRunListener | class FailAnnotatedTestOnLeakRunListener : FailTestOnLeakRunListener A JUnit RunListener extending FailTestOnLeakRunListener to detecting memory leaks in Android instrumentation tests only when the FailTestOnLeak annotation is used. |