Reputation: 1
I have a developed Webdriver tests that were run on a regular basis and were working successfully but have changed projects so stopped running them since April 2013. I could run them from TestNg within Java - Eclipse and also build them using Gradle.
When I try to run the scripts now (Using Chrome or any other browser.)this results in the following error:-
Parameter 'BROWSER' is required by @Test on method addFields but has not been marked @Optional or defined in C:\Users\li010ca\AppData\Local\Temp\testng-eclipse--942362152\testng-customsuite.xml]]>
MY TESTNG.xml looks like:-
<
!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="webDriver">
<test name="UI Test with Google Chrome" preserve-order="true">
<parameter name="BROWSER" value="CH"></parameter>
<classes>
<class name="com.pb.selenium.spider.testScripts.MyProj"></class>
<!--<class name="com.pb.selenium.spider.testScripts.DemoTest"></class>-->
</classes>
</test>
<test name="UI Test With FF" preserve-order="true">
<parameter name="BROWSER" value="FF"></parameter>
<classes>
</classes>
</test>
<test name="UI Test with IE" preserve-order="true">
<parameter name="BROWSER" value="IE"></parameter>
<classes>
</classes>
</test>
<test name="UI Test with Opera" preserve-order="true">
<parameter name="BROWSER" value="OPERA"></parameter>
<classes>
</classes>
</test>
</suite>
I have updated to use the latest Chromedriver. Is there anything else that has changed recently that may have caused this issue? Please can someone help? Thanks for you help in advance.
Upvotes: 0
Views: 5116
Reputation: 8531
When you trigger using eclipse as a single test, the testng suite level params are only utilized to create the custom testng suite. So you need to declare your parameter outside your test tag. Else you need to run by right-clicking on your xml file and then clicking on run as testng suite.
Upvotes: 2