AndroidDetectLeaksAssert

class AndroidDetectLeaksAssert(detectLeaksInterceptor: DetectLeaksInterceptor = AndroidDetectLeaksInterceptor(), heapAnalysisReporter: HeapAnalysisReporter = NoLeakAssertionFailedError.throwOnApplicationLeaks()) : DetectLeaksAssert

Default DetectLeaksAssert implementation. Uses public helpers so you should be able to create our own implementation if needed.

Leak detection can be skipped by annotating tests with SkipLeakDetection which requires the TestDescriptionHolder test rule be applied and evaluating when assertNoLeaks is called.

For improved leak detection, you should consider updating LeakCanary.Config.leakingObjectFinder to FilteringLeakingObjectFinder(AndroidObjectInspectors.appLeakingObjectFilters) when running in instrumentation tests. This changes leak detection from being incremental (based on AppWatcher to also scanning for all objects of known types in the heap).

Constructors

Link copied to clipboard
fun AndroidDetectLeaksAssert(detectLeaksInterceptor: DetectLeaksInterceptor = AndroidDetectLeaksInterceptor(), heapAnalysisReporter: HeapAnalysisReporter = NoLeakAssertionFailedError.throwOnApplicationLeaks())

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun assertNoLeaks(tag: String)