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


typealias GleanTestLocalServer = GleanTestLocalServer (source)

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

The rule takes care of sending Glean SDK pings to a local server, at the address: “http://localhost:”.

This is useful for Android instrumented tests, where we don’t want to initialize Glean more than once but still want to send pings to a local server for validation.

Example usage:

// Add the following lines to you test class.
val gleanRule = GleanTestLocalServer(3785)


localPort - the port of the local ping server