javaunit-testingtestngtestng-dataprovidertestng-annotation-test

How to get TestNG Method Invocation Arguments


I know it's possible to get a TestNG method's parameters as described here: https://testng.org/parameters.html

However, I need to get the TestNG method's arguments. Is this possible to get?

For comparison, I can get test method arguments in JUnit like so: https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/org/junit/jupiter/api/extension/ReflectiveInvocationContext.html#getArguments()

Thanks for your help!


Solution

  • Oh wait...it turns out in TestNG methods the parameters are the arguments. So, testResult.getParameters() works.

    Sorry my mistake. I've used JUnit previously and am new to TestNG. I was confused by how JUnit and TestNG have different definitions of parameters and arguments.