Class Parameters


  • public class Parameters
    extends Object
    Methods that bind parameters declared in testng.xml to actual values used to invoke methods.
    Author:
    Cedric Beust
    • Constructor Detail

      • Parameters

        public Parameters()
    • Method Detail

      • createConfigurationParameters

        public static Object[] createConfigurationParameters​(Method m,
                                                             Map<String,​String> params,
                                                             Object[] parameterValues,
                                                             @Nullable
                                                             ITestNGMethod currentTestMethod,
                                                             IAnnotationFinder finder,
                                                             XmlSuite xmlSuite,
                                                             ITestContext ctx,
                                                             ITestResult testResult)
        Creates the parameters needed for the specified @Configuration Method.
        Parameters:
        m - the configuraton method
        currentTestMethod - the current @Test method or null if no @Test is available (this is not only in case the configuration method is a @Before/@AfterMethod
        finder - the annotation finder
      • convertType

        public static <T> T convertType​(Class<T> type,
                                        String value,
                                        String paramName)
      • injectParameters

        public static Object[] injectParameters​(Object[] parameterValues,
                                                Method method,
                                                ITestContext context)
                                         throws TestNGException
        Gets an array of parameter values returned by data provider or the ones that are injected based on parameter type. The method also checks for NoInjection annotation
        Parameters:
        parameterValues - parameter values from a data provider
        method - method to be invoked
        context - test context
        Throws:
        TestNGException
      • getParametersFromIndex

        public static Object[] getParametersFromIndex​(Iterator<Object[]> parametersValues,
                                                      int index)