Package org.testng.internal
Class Parameters
- java.lang.Object
-
- org.testng.internal.Parameters
-
public class Parameters extends java.lang.Object
Methods that bind parameters declared in testng.xml to actual values used to invoke methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Parameters.MethodParameters
A parameter passing helper class.
-
Constructor Summary
Constructors Constructor Description Parameters()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Object[]
createConfigurationParameters(java.lang.reflect.Method m, java.util.Map<java.lang.String,java.lang.String> params, java.lang.Object[] parameterValues, ITestNGMethod currentTestMethod, IAnnotationFinder finder, XmlSuite xmlSuite, ITestContext ctx, ITestResult testResult)
Creates the parameters needed for the specified@Configuration
Method
.static java.lang.Object[]
createInstantiationParameters(java.lang.reflect.Constructor<?> ctor, java.lang.String methodAnnotation, IAnnotationFinder finder, java.lang.String[] parameterNames, java.util.Map<java.lang.String,java.lang.String> params, XmlSuite xmlSuite)
Creates the parameters needed for constructing a test class instance.static ParameterHolder
handleParameters(ITestObjectFactory objectFactory, ITestNGMethod testMethod, java.util.Map<java.lang.String,java.lang.String> allParameterNames, java.lang.Object instance, Parameters.MethodParameters methodParams, XmlSuite xmlSuite, IAnnotationFinder annotationFinder, java.lang.Object fedInstance, DataProviderHolder holder)
If the method has parameters, fill them in.static ParameterHolder
handleParameters(ITestObjectFactory objectFactory, ITestNGMethod testMethod, java.util.Map<java.lang.String,java.lang.String> allParameterNames, java.lang.Object instance, Parameters.MethodParameters methodParams, XmlSuite xmlSuite, IAnnotationFinder annotationFinder, java.lang.Object fedInstance, DataProviderHolder holder, java.lang.String annotationName)
If the method has parameters, fill them in.static java.lang.Object[]
injectParameters(java.lang.Object[] parameterValues, java.lang.reflect.Method method, ITestContext context)
Gets an array of parameter values returned by data provider or the ones that are injected based on parameter type.
-
-
-
Method Detail
-
createInstantiationParameters
public static java.lang.Object[] createInstantiationParameters(java.lang.reflect.Constructor<?> ctor, java.lang.String methodAnnotation, IAnnotationFinder finder, java.lang.String[] parameterNames, java.util.Map<java.lang.String,java.lang.String> params, XmlSuite xmlSuite)
Creates the parameters needed for constructing a test class instance.
-
createConfigurationParameters
public static java.lang.Object[] createConfigurationParameters(java.lang.reflect.Method m, java.util.Map<java.lang.String,java.lang.String> params, java.lang.Object[] parameterValues, ITestNGMethod currentTestMethod, IAnnotationFinder finder, XmlSuite xmlSuite, ITestContext ctx, ITestResult testResult)
Creates the parameters needed for the specified@Configuration
Method
.- Parameters:
m
- the configuraton methodcurrentTestMethod
- the current @Test method ornull
if no @Test is available (this is not only in case the configuration method is a @Before/@AfterMethodfinder
- the annotation finder
-
handleParameters
public static ParameterHolder handleParameters(ITestObjectFactory objectFactory, ITestNGMethod testMethod, java.util.Map<java.lang.String,java.lang.String> allParameterNames, java.lang.Object instance, Parameters.MethodParameters methodParams, XmlSuite xmlSuite, IAnnotationFinder annotationFinder, java.lang.Object fedInstance, DataProviderHolder holder)
If the method has parameters, fill them in. Either by using a @DataProvider if any was provided, or by looking up<parameters>
in testng.xml- Returns:
- An Iterator over the values for each parameter of this method.
-
handleParameters
public static ParameterHolder handleParameters(ITestObjectFactory objectFactory, ITestNGMethod testMethod, java.util.Map<java.lang.String,java.lang.String> allParameterNames, java.lang.Object instance, Parameters.MethodParameters methodParams, XmlSuite xmlSuite, IAnnotationFinder annotationFinder, java.lang.Object fedInstance, DataProviderHolder holder, java.lang.String annotationName)
If the method has parameters, fill them in. Either by using a @DataProvider if any was provided, or by looking up<parameters>
in testng.xml- Returns:
- An Iterator over the values for each parameter of this method.
-
injectParameters
public static java.lang.Object[] injectParameters(java.lang.Object[] parameterValues, java.lang.reflect.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 forNoInjection
annotation- Parameters:
parameterValues
- parameter values from a data providermethod
- method to be invokedcontext
- test context- Throws:
TestNGException
-
-