Annotation Type DataProvider


  • @Retention(RUNTIME)
    @Target(METHOD)
    @Documented
    public @interface DataProvider
    Mark a method as supplying data for a test method.

    The name defaults to the name of the annotated method.

    The annotated method must return any of the following:

    • Object[][] or Iterator<Object[]>, where each Object[] is assigned to the parameter list of the test method.
    • Object[] or Iterator<Object>, where each Object is assigned to the single parameter of the test method.

    The @Test method that wants to receive data from this DataProvider needs to use a Test.dataProvider() name equal to the name of this annotation.

    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      int[] indices
      Which indices to run from this data provider, default: all.
      java.lang.String name
      The name of this DataProvider.
      boolean parallel
      Whether this data provider should be run in parallel.
    • Element Detail

      • name

        java.lang.String name
        The name of this DataProvider.
        Returns:
        the value (default empty)
        Default:
        ""
      • parallel

        boolean parallel
        Whether this data provider should be run in parallel.
        Returns:
        the value (default false)
        Default:
        false
      • indices

        int[] indices
        Which indices to run from this data provider, default: all.
        Returns:
        the value
        Default:
        {}