Environment:
Java, Selenium webdriver, Maven, testNG, Log4J, Eclipse
I created a test. I created xml file to run the test in IE and chrome. I ran the xml suite file and it ran the script in both browsers just fine.
After that, I added log4j maven dependency plus added logger to all tests, base tests, base page objects. Fixed all the loggers errors.
I ran the xml suite again and I get this error:
org.testng.TestNGException: Method requires 1 parameters but 0 were supplied in the @Test annotation.
I added few scrint prints here. I am not sure how I can fix the error. I spent 3 hours and I am unable to fix it.
https://drive.google.com/open?id=1HqmQ2h_axwISGvxbZe6IHHczF8zW1HBLcRtsEx0YhvE
Please advise.
I would suggest that you please spend sometime understanding how @Parameters work in TestNG.
You can get a good heads up from the TestNG documentation : http://testng.org/doc/documentation-main.html (Refer to 5.6 parameters section)
On a high level here’s how the @Parameters annotation works in TestNG.
First you create a suite xml which can look something like below [ Pay attention to the <parameters> tag. If its located outside of the <test> tag, then it means the parameter value is applicable across all the <test> tags in the <suite> . If the <parameters> tag is included within a <test> tag, then its scope is limited to the <test> tag to which its applicable to ]
<suite name="My suite">
<parameter name="first-name" value="Cedric"/>
<test name="Simple example">
<-- ... -->
You would now define a test method which consumes the above parameters as follows :
@Parameters({ "first-name" })
@Test
public void testSingleString(String firstName) {
System.out.println("Invoked testString " + firstName);
assert "Cedric".equals(firstName);
}
Here you need to ensure that the @Parameters annotation’s values matches with what has been specified in the <parameters> tag. You also need to ensure that the number of <parameters> tag matches with the number of strings passed to the @Parameters attributes and also the number of @Test annotated method arguments. Once you fix all these anomalies in your project you should be good.
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/30860c5a-b603-4cf6-b3af-474822bf19b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.