public final class InstrumentationRegistry
extends Object
| java.lang.Object | |
| ↳ | android.support.test.InstrumentationRegistry |
一个公开的注册表实例,它包含对流程中运行的检测的引用,它是参数。 还为调用者提供了一个简单的方法来获取工具,应用程序上下文和工具参数Bundle。
Public methods |
|
|---|---|
static Bundle |
getArguments() 返回工具参数Bundle的副本。 |
static Context |
getContext() 返回这个工具包的上下文。 |
static Instrumentation |
getInstrumentation() 返回当前正在运行的检测。 |
static Context |
getTargetContext() 为正在检测的目标应用程序返回一个上下文。 |
static void |
registerInstance(Instrumentation instrumentation, Bundle arguments) 记录/公开正在运行的检测工具,并将检测参数Bundle的副本存储在注册表中。 |
Inherited methods |
|
|---|---|
java.lang.Object
|
|
Bundle getArguments ()
返回工具参数Bundle的副本。 使用此获得Bundle包含传递给命令行参数Instrumentation到您的测试。
本软件包不保证在所有工具下出现。
| Returns | |
|---|---|
Bundle |
Bundle the arguments for this instrumentation. |
| Throws | |
|---|---|
IllegalStateException |
if no argument Bundle has been registered. |
Instrumentation getInstrumentation ()
返回当前正在运行的检测。 使用这个来获得一个Instrumentation进入你的测试。
| Returns | |
|---|---|
Instrumentation |
|
| Throws | |
|---|---|
IllegalStateException |
if instrumentation hasn't been registered |
Context getTargetContext ()
为正在检测的目标应用程序返回一个上下文。 使用此获得Context代表getTargetContext()到您的测试。
| Returns | |
|---|---|
Context |
|
void registerInstance (Instrumentation instrumentation,
Bundle arguments)
记录/公开正在运行的检测工具,并将检测参数Bundle的副本存储在注册表中。
这是一个全局注册表 - 因此请注意调用此方法的影响!
| Parameters | |
|---|---|
instrumentation |
Instrumentation: the instrumentation currently running. |
arguments |
Bundle: the arguments for this application. Null deregisters any existing arguments. |