Summary: Ctors | Methods | Protected Methods | Inherited Methods | [Expand All]

# LoggingBaseRule

`public abstract class LoggingBaseRule`
`` `extends ExternalResource` ``

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

Known Direct Subclasses EnableTestTracingRule, LogBatteryInformationRule, LogDeviceGetPropInfoRule, LogGraphicsStatsRule, LogLogcatRule, LogNetStatsRule
EnableTestTracingRule | When applied to a test class this `TestRule` calls `Trace.beginSection()` before test method execution.
LogBatteryInformationRule | When applied to a test class this `Rule` resets battery information ("stats") before test method execution.
LogDeviceGetPropInfoRule | When applied to a test class this `Rule` executes the "getprop" device command after test method execution and logs it to a file on external storage.
LogGraphicsStatsRule | When applied to a test class this `Rule` performs a graphics system information reset before test method execution.
LogLogcatRule | When applied to a test class this `Rule` attempts to clear the Logcat buffer on the device before test method execution.
LogNetStatsRule | When applied to a test class this `Rule` performs a network system information reset before test method execution.

Base class for logging rules to remove boiler-plate instance variables used by most logging rules.

## Summary

### Public constructors
`LoggingBaseRule()`
`LoggingBaseRule(File logFileOutputDirectory, String fileName)` Request the log be written to a specific location.

### Public methods
`final void` | `after()`
`final Statement` | `apply(Statement base, Description description)`
`final void` | `before()`
`void` | `setTestRunNumber(int testRunNumber)` Indicate to the `Rule` that this is the `testRunNumber`th time the test method is being called in a test instrumentation.

### Protected methods
`String` | `getLogFileName()`
`File` | `getLogFileOutputDirectory()`
`String` | `getPackageNameUnderTest()`
`String` | `getTestClass()`
`String` | `getTestName()`
`int` | `getTestRunNumber()`

### Inherited methods
From class `org.junit.rules.ExternalResource`
`void` | `after()`
`Statement` | `apply(Statement arg0, Description arg1)`
`void` | `before()`
From class `java.lang.Object`
`Object` | `clone()`
`boolean` | `equals(Object arg0)`
`void` | `finalize()`
`final Class<?>` | `getClass()`
`int` | `hashCode()`
`final void` | `notify()`
`final void` | `notifyAll()`
`String` | `toString()`
`final void` | `wait(long arg0, int arg1)`
`final void` | `wait(long arg0)`
`final void` | `wait()`
From interface `org.junit.rules.TestRule`
`abstract Statement` | `apply(Statement arg0, Description arg1)`

## Public constructors

### LoggingBaseRule

    LoggingBaseRule ()

### LoggingBaseRule

    LoggingBaseRule (File logFileOutputDirectory,
                    String fileName)

Request the log be written to a specific location.

File logFileOutputDirectory directory to log output to String fileName to override the default file name, if desired

Parameters
`logFileOutputDirectory` | `File`
`fileName` | `String`

## Public methods

### after

    void after ()

### apply

    Statement apply (Statement base,
                    Description description)

Parameters
`base` | `Statement`
`description` | `Description`

Returns
`Statement` |

### before

    void before ()

### setTestRunNumber

    void setTestRunNumber (int testRunNumber)

Indicate to the `Rule` that this is the `testRunNumber`th time the test method is being called in a test instrumentation. This method only needs to be called when a test method is being called multiple times in a test instrumentation.

Parameters
`testRunNumber` | `int`: indicates the nth run for the test method in zero-index form

## Protected methods

### getLogFileName

    String getLogFileName ()

Returns
`String` |

### getLogFileOutputDirectory

    File getLogFileOutputDirectory ()

Returns
`File` |

### getPackageNameUnderTest

    String getPackageNameUnderTest ()

Returns
`String` |

### getTestClass

    String getTestClass ()

Returns
`String` |

### getTestName

    String getTestName ()

Returns
`String` |

### getTestRunNumber

    int getTestRunNumber ()

Returns
`int` |

- ## Classes

  - AtraceLogger
  - EnableTestTracingRule
  - LogBatteryInformationRule
  - LogDeviceGetPropInfoRule
  - LoggingBaseRule
  - LogGraphicsStatsRule
  - LogLogcatRule
  - LogNetStatsRule
  - RuleLoggingUtils