DeviceJUnit4ClassRunner.TestMetrics
public static class DeviceJUnit4ClassRunner.TestMetrics
extends ExternalResource
java.lang.Oggetto | ||
↳ | org.junit.rules.ExternalResource | |
↳ | com.android.tradefed.testtype.DeviceJUnit4ClassRunner.TestMetrics |
Implementazione di ExternalResource
e TestRule
. Questa regola consente di registrare le metriche durante un test case (all'interno di @Test). Garantisce che la mappa delle metriche venga pulita tra i test, quindi lo stesso oggetto regola può essere riutilizzato.
Example: @Rule public TestMetrics metrics = new TestMetrics(); @Test public void testFoo() { metrics.addTestMetric("key", "value"); metrics.addTestMetric("key2", "value2"); } @Test public void testFoo2() { metrics.addTestMetric("key3", "value3"); }
Riepilogo
Costruttori pubblici | |
---|---|
TestMetrics () |
Metodi pubblici | |
---|---|
void | addTestMetric (String key, MetricMeasurement.Metric metric) Registrare una voce di metrica in formato proto per il test case. |
void | addTestMetric (String key, String value) Registrare una voce di metrica per il test case. |
Statement | apply (Statement base, Description description) |
Metodi protetti | |
---|---|
void | after () |
void | before () |
Costruttori pubblici
TestMetrics
public TestMetrics ()
Metodi pubblici
addTestMetric
public void addTestMetric (String key, MetricMeasurement.Metric metric)
Registrare una voce di metrica in formato proto per il test case. Ogni chiave all'interno di un test case deve essere univoca, altrimenti sovrascriverà il valore precedente.
Parametri | |
---|---|
key | String : la chiave della metrica. |
metric | MetricMeasurement.Metric : il valore associato alla chiave. |
addTestMetric
public void addTestMetric (String key, String value)
Registrare una voce di metrica per il test case. Ogni chiave all'interno di un test case deve essere univoca, altrimenti sovrascriverà il valore precedente.
Parametri | |
---|---|
key | String : la chiave della metrica. |
value | String : il valore associato alla chiave. |
fare domanda a
public Statement apply (Statement base, Description description)
Parametri | |
---|---|
base | Statement |
description | Description |
ritorna | |
---|---|
Statement |
Metodi protetti
Dopo
protected void after ()
Prima
protected void before ()