public class JankTestBase
extends InstrumentationTestCase
java.lang.Object | ||||
↳ | junit.framework.Assert | |||
↳ | junit.framework.TestCase | |||
↳ | android.test.InstrumentationTestCase | |||
↳ | android.support.test.jank.JankTestBase |
用于测量Jank的基础测试类。 这个测试类在执行每种测试方法时自动监测jank。 根据'迭代'命令行参数,每个测试方法在循环中执行多次。 要为每次迭代执行其他设置/拆卸步骤,子类可以选择覆盖beforeLoop()
和afterLoop()
方法。 测试方法必须使用JankTest
注释进行配置。 至少要指定要测量的结果类型和期望帧的数量。
Public constructors |
|
---|---|
JankTestBase() |
Public methods |
|
---|---|
void |
afterLoop() 每次迭代测试方法后调用。 |
void |
afterTest(Bundle metrics) 所有迭代完成后调用一次。 |
void |
beforeLoop() 在每次迭代测试方法之前调用。 |
void |
beforeTest() 在执行测试方法之前调用一次。 |
final int |
getCurrentIteration() 返回当前正在执行的迭代的索引。 |
Protected methods |
|
---|---|
IMonitorFactory |
createMonitorFactory() 创建一个 |
final Bundle |
getArguments() 返回包含命令行参数的 |
IMonitorFactory |
getMonitorFactory() 对于给定的测试方法,返回应该用于构造适用的 |
List<IMonitor> |
getMonitors(Method method) 返回列表 |
void |
runTest() |
Inherited methods |
|
---|---|
From class android.test.InstrumentationTestCase
|
|
From class junit.framework.TestCase
|
|
From class junit.framework.Assert
|
|
From class java.lang.Object
|
|
From interface junit.framework.Test
|
JankTestBase ()
void afterLoop ()
每次迭代测试方法后调用。
Throws | |
---|---|
异常 |
void afterTest (Bundle metrics)
所有迭代完成后调用一次。
注意:默认实现通过 sendStatus(int, Bundle)
报告汇总的jank度量标准
Parameters | |
---|---|
metrics |
Bundle : the aggregated jank metrics after looped execution |
void beforeLoop ()
在每次迭代测试方法之前调用。
Throws | |
---|---|
异常 |
void beforeTest ()
在执行测试方法之前调用一次。
Throws | |
---|---|
异常 |
int getCurrentIteration ()
返回当前正在执行的迭代的索引。
Returns | |
---|---|
int |
IMonitorFactory createMonitorFactory ()
创建一个 IMonitorFactory
实例,该实例应该用于为 IMonitor
中的测试方法构造 IMonitor
(s)。
Returns | |
---|---|
IMonitorFactory |
IMonitorFactory getMonitorFactory ()
返回应该用于为给定测试方法构造适用 IMonitor
(s)的 IMonitorFactory
实例。
Returns | |
---|---|
IMonitorFactory |
List<IMonitor> getMonitors (Method method)
返回列表 IMonitor
应适用于将指定的 method
。
Parameters | |
---|---|
method |
方法
|
Returns | |
---|---|
List<IMonitor> |
void runTest ()
Throws | |
---|---|
Throwable |