android-components / mozilla.components.service.glean.testing / GleanTestRule

GleanTestRule

class GleanTestRule : TestWatcher (source)

This implements a JUnit rule for writing tests for Glean SDK metrics.

The rule takes care of resetting the Glean SDK between tests and initializing all the required dependencies.

Example usage:

// Add the following lines to you test class.
@get:Rule
val gleanRule = GleanTestRule(ApplicationProvider.getApplicationContext())

Parameters

context - the application context

configToUse - an optional Configuration to initialize the Glean SDK with

Constructors

Name Summary
<init> GleanTestRule(context: <ERROR CLASS>, configToUse: Configuration = Configuration())
This implements a JUnit rule for writing tests for Glean SDK metrics.

Properties

Name Summary
configToUse val configToUse: Configuration
an optional Configuration to initialize the Glean SDK with
context val context: <ERROR CLASS>
the application context

Functions

Name Summary
starting fun starting(description: Description?): Unit