Skip to content

Most visited

Recently visited

navigation

LogNetStatsRule

public class LogNetStatsRule
extends LoggingBaseRule

java.lang.Object
   ↳ org.junit.rules.ExternalResource
     ↳ android.support.test.rule.logging.LoggingBaseRule
       ↳ android.support.test.rule.logging.LogNetStatsRule


When applied to a test class this Rule performs a network system information reset before test method execution. The Rule then collects network system information after test method execution and logs it to a file on external storage. The default file location is maintained at getTestDir(String, String, int). The Rule performs these actions through the execution of a dumpsys on the netstats service.

The Rule's before() and after() methods can also be used for logging battery information across a test suite by manually invoking the methods in a RunListener.

Usage: \@Rule public LogNetStatsRule mLogNetStatsRule = new LogNetStatsRule();

Summary

Public constructors

LogNetStatsRule()
LogNetStatsRule(File logFileOutputDirectory, String fileName)

Public methods

void afterTest()
void beforeTest()

Inherited methods

From class android.support.test.rule.logging.LoggingBaseRule
From class org.junit.rules.ExternalResource
From class java.lang.Object
From interface org.junit.rules.TestRule

Public constructors

LogNetStatsRule

LogNetStatsRule ()

LogNetStatsRule

LogNetStatsRule (File logFileOutputDirectory, 
                String fileName)

Parameters
logFileOutputDirectory File
fileName String

Public methods

afterTest

void afterTest ()

beforeTest

void beforeTest ()

This site uses cookies to store your preferences for site-specific language and display options.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.