Class ParameterizedRobolectricTestRunner

java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<org.junit.runner.Runner>
org.junit.runners.Suite
org.robolectric.ParameterizedRobolectricTestRunner
All Implemented Interfaces:
org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Orderable, org.junit.runner.manipulation.Sortable

public final class ParameterizedRobolectricTestRunner extends org.junit.runners.Suite
A Parameterized test runner for Robolectric. Copied from the Parameterized class, then modified the custom test runner to extend the RobolectricTestRunner. The RobolectricTestRunner.getHelperTestRunner(Class) is overridden in order to create instances of the test class with the appropriate parameters. Merged in the ability to name your tests through the ParameterizedRobolectricTestRunner.Parameters.name() property. Merged in support for ParameterizedRobolectricTestRunner.Parameter annotation alternative to providing a constructor.

This class takes care of the fact that the test runner and the test class are actually loaded from different class loaders and therefore parameter objects created by one cannot be assigned to instances of the other.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Annotation for fields of the test class which will be initialized by the method annotated by Parameters
    By using directly this annotation, the test class constructor isn't needed.
    Index range must start at 0.
    static @interface 
    Annotation for a method which provides parameters to be injected into the test class constructor by Parameterized

    Nested classes/interfaces inherited from class org.junit.runners.Suite

    org.junit.runners.Suite.SuiteClasses
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected List<org.junit.runner.Runner>
     

    Methods inherited from class org.junit.runners.Suite

    describeChild, emptySuite, runChild

    Methods inherited from class org.junit.runners.ParentRunner

    childrenInvoker, classBlock, classRules, collectInitializationErrors, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, isIgnored, order, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolation

    Methods inherited from class org.junit.runner.Runner

    testCount

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ParameterizedRobolectricTestRunner

      public ParameterizedRobolectricTestRunner(Class<?> klass) throws Throwable
      Throws:
      Throwable
  • Method Details

    • getChildren

      protected List<org.junit.runner.Runner> getChildren()
      Overrides:
      getChildren in class org.junit.runners.Suite