Package org.robolectric
Class RobolectricTestParameterInjector
java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
org.junit.runners.BlockJUnit4ClassRunner
org.robolectric.internal.SandboxTestRunner
org.robolectric.RobolectricTestRunner
org.robolectric.RobolectricTestParameterInjector
- All Implemented Interfaces:
org.junit.runner.Describable
,org.junit.runner.manipulation.Filterable
,org.junit.runner.manipulation.Orderable
,org.junit.runner.manipulation.Sortable
A
RobolectricTestRunner
that supports TestParameterInjector
parameter injection.
This runner provides several benefits over the ParameterizedRobolectricTestRunner
, in
particular:
- It provides convenient syntax for supporting field parameter injection.
- It allows parameterizing individual test methods using
TestParameter
. - It provides easy to use declarative syntax for parameter combinations using
TestParameters
.
See https://github.com/google/TestParameterInjector for more details.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Interface to allow sandboxed injected runner to be accessed from the helper runner.Nested classes/interfaces inherited from class org.robolectric.RobolectricTestRunner
RobolectricTestRunner.DeprecatedTestRunnerDefaultConfigProvider, RobolectricTestRunner.HelperTestRunner, RobolectricTestRunner.RobolectricFrameworkMethod
-
Field Summary
Fields inherited from class org.robolectric.RobolectricTestRunner
CONFIG_PROPERTIES
Fields inherited from class org.robolectric.internal.SandboxTestRunner
classHandlerBuilder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected InstrumentationConfiguration
createClassLoaderConfig
(org.junit.runners.model.FrameworkMethod method) Create anInstrumentationConfiguration
suitable for the providedFrameworkMethod
.protected com.google.common.collect.ImmutableList<org.junit.runners.model.FrameworkMethod>
protected RobolectricTestRunner.HelperTestRunner
getHelperTestRunner
(Class<?> sandboxedTestClass) protected void
validateConstructor
(List<Throwable> errors) protected void
validateTestMethods
(List<Throwable> errors) Methods inherited from class org.robolectric.RobolectricTestRunner
afterClass, afterTest, beforeTest, buildGlobalConfig, createAndroidManifest, createClassHandler, createTest, defaultInjector, finallyAfterTest, findInterceptors, getBuildSystemApiProperties, getExtraShadows, getManifestFactory, getSandbox, getTestLifecycleClass, staticGetBuildSystemApiProperties
Methods inherited from class org.robolectric.internal.SandboxTestRunner
classBlock, configureSandbox, getInterceptors, methodBlock, withPotentialTimeout
Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner
collectInitializationErrors, computeTestMethods, createTest, describeChild, getTestRules, isIgnored, methodInvoker, possiblyExpectingExceptions, rules, runChild, testName, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateZeroArgConstructor, withAfters, withBefores
Methods inherited from class org.junit.runners.ParentRunner
childrenInvoker, classRules, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, order, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolation
Methods inherited from class org.junit.runner.Runner
testCount
-
Constructor Details
-
RobolectricTestParameterInjector
public RobolectricTestParameterInjector(Class<?> testClass) throws org.junit.runners.model.InitializationError - Throws:
org.junit.runners.model.InitializationError
-
-
Method Details
-
validateConstructor
- Overrides:
validateConstructor
in classorg.junit.runners.BlockJUnit4ClassRunner
-
validateTestMethods
- Overrides:
validateTestMethods
in classorg.junit.runners.BlockJUnit4ClassRunner
-
createClassLoaderConfig
protected InstrumentationConfiguration createClassLoaderConfig(org.junit.runners.model.FrameworkMethod method) Description copied from class:RobolectricTestRunner
Create anInstrumentationConfiguration
suitable for the providedFrameworkMethod
.Adds configuration for Android using
AndroidConfigurer
.Custom TestRunner subclasses may wish to override this method to provide additional configuration.
- Overrides:
createClassLoaderConfig
in classRobolectricTestRunner
- Parameters:
method
- the test method that's about to run- Returns:
- an
InstrumentationConfiguration
-
getChildren
protected com.google.common.collect.ImmutableList<org.junit.runners.model.FrameworkMethod> getChildren()- Overrides:
getChildren
in classRobolectricTestRunner
-
getHelperTestRunner
protected RobolectricTestRunner.HelperTestRunner getHelperTestRunner(Class<?> sandboxedTestClass) throws org.junit.runners.model.InitializationError - Overrides:
getHelperTestRunner
in classRobolectricTestRunner
- Throws:
org.junit.runners.model.InitializationError
-