Class ParameterizedClientTestRunner

  • All Implemented Interfaces:
    org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Orderable, org.junit.runner.manipulation.Sortable

    public class ParameterizedClientTestRunner
    extends ClientTestRunner
    Parameterized form of ClientTestRunner.
    Note: The shared IPlatform is available while invoking the Parameterized.Parameters-annotated method, but it is no invoked within an IClientSession context.
    Example:
     @RunWith(ParameterizedServerTestRunner.class)
     public class SampleParameterizedServerTest {
    
       @Parameters
       public static List<IScoutTestParameter> getParameters() {
         List<IScoutTestParameter> parametersList = new LinkedList<IScoutTestParameter>();
         parametersList.add(new MathTestParameter("Scenario 1", 2));
         parametersList.add(new MathTestParameter("Scenario 2", 5));
         return parametersList;
       }
    
       private final MathTestParameter m_testParameter;
    
       public SampleParameterizedServerTest(MathTestParameter testParameter) {
         m_testParameter = testParameter;
       }
    
       @Test
       public void testIsGreaterZero() {
         assertTrue(m_testParameter.getX() > 0);
       }
    
       @Test
       @NonParameterized
       public void testGeneral() {
         assertFalse(0 > 0);
       }
    
       static class MathTestParameter extends AbstractScoutTestParameter {
         private int m_x;
    
         public MathTestParameter(String name, int x) {
           super(name);
           m_x = x;
         }
    
         public int getX() {
           return m_x;
         }
       }
     }
     
    See Also:
    ParameterizedServerTestRunner, Parameterized, Parameterized.Parameters
    • Constructor Detail

      • ParameterizedClientTestRunner

        public ParameterizedClientTestRunner​(Class<?> klass)
                                      throws org.junit.runners.model.InitializationError
        Throws:
        org.junit.runners.model.InitializationError
    • Method Detail

      • getChildren

        protected List<org.junit.runners.model.FrameworkMethod> getChildren()
        Overrides:
        getChildren in class org.junit.runners.BlockJUnit4ClassRunner
      • createTest

        protected final Object createTest()
                                   throws Exception
        Overrides:
        createTest in class org.junit.runners.BlockJUnit4ClassRunner
        Throws:
        Exception
      • createTestInternal

        protected Object createTestInternal​(org.eclipse.scout.rt.testing.platform.runner.parameterized.IScoutTestParameter testParameter)
                                     throws Exception
        Throws:
        Exception
      • methodBlock

        protected org.junit.runners.model.Statement methodBlock​(org.junit.runners.model.FrameworkMethod method)
        Overrides:
        methodBlock in class org.eclipse.scout.rt.testing.platform.runner.PlatformTestRunner
      • collectInitializationErrors

        protected void collectInitializationErrors​(List<Throwable> errors)
        Overrides:
        collectInitializationErrors in class org.junit.runners.BlockJUnit4ClassRunner
      • validateConstructor

        protected void validateConstructor​(List<Throwable> errors)
        Overrides:
        validateConstructor in class org.junit.runners.BlockJUnit4ClassRunner
      • validateParametersMethod

        protected void validateParametersMethod​(List<Throwable> errors)
        Validate the method which specifies the test parameters.
      • describeChild

        protected org.junit.runner.Description describeChild​(org.junit.runners.model.FrameworkMethod method)
        Overrides:
        describeChild in class org.junit.runners.BlockJUnit4ClassRunner