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
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface 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.internal.SandboxTestRunner
classHandlerBuilder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected InstrumentationConfigurationcreateClassLoaderConfig(org.junit.runners.model.FrameworkMethod method) Create anInstrumentationConfigurationsuitable for the providedFrameworkMethod.protected com.google.common.collect.ImmutableList<org.junit.runners.model.FrameworkMethod> protected RobolectricTestRunner.HelperTestRunnergetHelperTestRunner(Class<?> sandboxedTestClass) protected voidvalidateConstructor(List<Throwable> errors) protected voidvalidateTestMethods(List<Throwable> errors) Methods inherited from class org.robolectric.RobolectricTestRunner
afterTest, beforeTest, buildGlobalConfig, configureSandbox, createAndroidManifest, createClassHandler, createTest, defaultInjector, finallyAfterTest, findInterceptors, getBuildSystemApiProperties, getExtraShadows, getManifestFactory, getSandbox, getTestLifecycleClass, loadRunListeners, run, staticGetBuildSystemApiPropertiesMethods inherited from class org.robolectric.internal.SandboxTestRunner
afterClass, classBlock, getInterceptors, methodBlock, withPotentialTimeoutMethods inherited from class org.junit.runners.BlockJUnit4ClassRunner
collectInitializationErrors, computeTestMethods, createTest, describeChild, getTestRules, isIgnored, methodInvoker, possiblyExpectingExceptions, rules, runChild, testName, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateZeroArgConstructor, withAfters, withBeforesMethods inherited from class org.junit.runners.ParentRunner
childrenInvoker, classRules, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, order, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolationMethods 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:
validateConstructorin classorg.junit.runners.BlockJUnit4ClassRunner
-
validateTestMethods
- Overrides:
validateTestMethodsin classorg.junit.runners.BlockJUnit4ClassRunner
-
createClassLoaderConfig
@Nonnull protected InstrumentationConfiguration createClassLoaderConfig(org.junit.runners.model.FrameworkMethod method) Description copied from class:RobolectricTestRunnerCreate anInstrumentationConfigurationsuitable for the providedFrameworkMethod.Adds configuration for Android using
AndroidConfigurer.Custom TestRunner subclasses may wish to override this method to provide additional configuration.
- Overrides:
createClassLoaderConfigin 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:
getChildrenin classRobolectricTestRunner
-
getHelperTestRunner
protected RobolectricTestRunner.HelperTestRunner getHelperTestRunner(Class<?> sandboxedTestClass) throws org.junit.runners.model.InitializationError - Overrides:
getHelperTestRunnerin classRobolectricTestRunner- Throws:
org.junit.runners.model.InitializationError
-