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

# JankTestBase

`public class JankTestBase`
`` `` `` `extends InstrumentationTestCase` ``

java.lang.Object
↳ | junit.framework.Assert
| ↳ | junit.framework.TestCase
|  | ↳ | android.test.InstrumentationTestCase
|  |  | ↳ | android.support.test.jank.JankTestBase

Base test class for measuring Jank. This test class automatically monitors jank while executing each test method. Each test method is executed several times in a loop, according to the 'iterations' command line parameter. To perform additional setup / tear down steps for each iteration, subclasses can optionally override `beforeLoop()` and `afterLoop()` methods. Test methods must be configured with the `JankTest` annotation. At minimum, the type of jank to measure and the number of expected frames must be specified.

## Summary

### Public constructors
`JankTestBase()`

### Public methods
`void` | `afterLoop()` Called after each iteration of the test method.
`void` | `afterTest(Bundle metrics)` Called once after all iterations have completed.
`void` | `beforeLoop()` Called before each iteration of the test method.
`void` | `beforeTest()` Called once before executing a test method.
`final int` | `getCurrentIteration()` Return the index of the currently executing iteration.

### Protected methods
`IMonitorFactory` | `createMonitorFactory()` Creates an `IMonitorFactory` instance that should be used to construct `IMonitor`(s) for the test methods in this class.
`final Bundle` | `getArguments()` Returns a `Bundle` containing the command line parameters.
`IMonitorFactory` | `getMonitorFactory()` Returns the `IMonitorFactory` instance that should be used to construct applicable `IMonitor`(s) for a given test method.
`List<IMonitor>` | `getMonitors(Method method)` Returns the list of `IMonitor`s that should be applied to the given `method`.
`void` | `runTest()`

### Inherited methods
From class `android.test.InstrumentationTestCase`
`Instrumentation` | `getInstrumentation()`
`void` | `injectInsrumentation(Instrumentation arg0)`
`void` | `injectInstrumentation(Instrumentation arg0)`
`final <T extends Activity> T` | `launchActivity(String arg0, Class<T> arg1, Bundle arg2)`
`final <T extends Activity> T` | `launchActivityWithIntent(String arg0, Class<T> arg1, Intent arg2)`
`void` | `runTest()`
`void` | `runTestOnUiThread(Runnable arg0)`
`void` | `sendKeys(String arg0)`
`void` | `sendKeys(int... arg0)`
`void` | `sendRepeatedKeys(int... arg0)`
`void` | `tearDown()`
From class `junit.framework.TestCase`
`int` | `countTestCases()`
`TestResult` | `createResult()`
`String` | `getName()`
`TestResult` | `run()`
`void` | `run(TestResult arg0)`
`void` | `runBare()`
`void` | `runTest()`
`void` | `setName(String arg0)`
`void` | `setUp()`
`void` | `tearDown()`
`String` | `toString()`
From class `junit.framework.Assert`
`static void` | `assertEquals(boolean arg0, boolean arg1)`
`static void` | `assertEquals(String arg0, long arg1, long arg2)`
`static void` | `assertEquals(short arg0, short arg1)`
`static void` | `assertEquals(String arg0, String arg1, String arg2)`
`static void` | `assertEquals(String arg0, int arg1, int arg2)`
`static void` | `assertEquals(Object arg0, Object arg1)`
`static void` | `assertEquals(String arg0, boolean arg1, boolean arg2)`
`static void` | `assertEquals(String arg0, String arg1)`
`static void` | `assertEquals(String arg0, short arg1, short arg2)`
`static void` | `assertEquals(String arg0, Object arg1, Object arg2)`
`static void` | `assertEquals(char arg0, char arg1)`
`static void` | `assertEquals(byte arg0, byte arg1)`
`static void` | `assertEquals(double arg0, double arg1, double arg2)`
`static void` | `assertEquals(String arg0, char arg1, char arg2)`
`static void` | `assertEquals(float arg0, float arg1, float arg2)`
`static void` | `assertEquals(String arg0, double arg1, double arg2, double arg3)`
`static void` | `assertEquals(String arg0, byte arg1, byte arg2)`
`static void` | `assertEquals(String arg0, float arg1, float arg2, float arg3)`
`static void` | `assertEquals(long arg0, long arg1)`
`static void` | `assertEquals(int arg0, int arg1)`
`static void` | `assertFalse(String arg0, boolean arg1)`
`static void` | `assertFalse(boolean arg0)`
`static void` | `assertNotNull(Object arg0)`
`static void` | `assertNotNull(String arg0, Object arg1)`
`static void` | `assertNotSame(String arg0, Object arg1, Object arg2)`
`static void` | `assertNotSame(Object arg0, Object arg1)`
`static void` | `assertNull(String arg0, Object arg1)`
`static void` | `assertNull(Object arg0)`
`static void` | `assertSame(String arg0, Object arg1, Object arg2)`
`static void` | `assertSame(Object arg0, Object arg1)`
`static void` | `assertTrue(String arg0, boolean arg1)`
`static void` | `assertTrue(boolean arg0)`
`static void` | `fail(String arg0)`
`static void` | `fail()`
`static void` | `failNotEquals(String arg0, Object arg1, Object arg2)`
`static void` | `failNotSame(String arg0, Object arg1, Object arg2)`
`static void` | `failSame(String arg0)`
`static String` | `format(String arg0, Object arg1, Object arg2)`
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 `junit.framework.Test`
`abstract int` | `countTestCases()`
`abstract void` | `run(TestResult arg0)`

## Public constructors

### JankTestBase

    JankTestBase ()

## Public methods

### afterLoop

    void afterLoop ()

Called after each iteration of the test method.

Throws
`Exception` |

### afterTest

    void afterTest (Bundle metrics)

Called once after all iterations have completed.

Note: default implementation reports the aggregated jank metrics via `sendStatus(int, Bundle)`

Parameters
`metrics` | `Bundle`: the aggregated jank metrics after looped execution

### beforeLoop

    void beforeLoop ()

Called before each iteration of the test method.

Throws
`Exception` |

### beforeTest

    void beforeTest ()

Called once before executing a test method.

Throws
`Exception` |

### getCurrentIteration

    int getCurrentIteration ()

Return the index of the currently executing iteration.

Returns
`int` |

## Protected methods

### createMonitorFactory

    IMonitorFactory createMonitorFactory ()

Creates an `IMonitorFactory` instance that should be used to construct `IMonitor`(s) for the test methods in this class.

Returns
`IMonitorFactory` |

### getArguments

    Bundle getArguments ()

Returns a `Bundle` containing the command line parameters.

Returns
`Bundle` |

### getMonitorFactory

    IMonitorFactory getMonitorFactory ()

Returns the `IMonitorFactory` instance that should be used to construct applicable `IMonitor`(s) for a given test method.

Returns
`IMonitorFactory` |

### getMonitors

    List<IMonitor> getMonitors (Method method)

Returns the list of `IMonitor`s that should be applied to the given `method`.

Parameters
`method` | `Method`

Returns
`List<IMonitor>` |

### runTest

    void runTest ()

Throws
`Throwable` |

- ## Annotations

  - GfxMonitor
  - JankTest

- ## Interfaces

  - IMonitor
  - IMonitorFactory

- ## Classes

  - JankTestBase