参数BROWSER缺少通过TestNG和Eclipse运行Webdriver的错误 [英] Parameter BROWSER missing error running Webdriver through TestNG and Eclipse

查看:77
本文介绍了参数BROWSER缺少通过TestNG和Eclipse运行Webdriver的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个已开发的Webdriver测试,该测试会定期运行并成功运行,但已更改了项目,因此自2013年4月起停止运行它们. 我可以在Java-Eclipse的TestNg中运行它们,也可以使用Gradle构建它们.

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.

当我尝试立即运行脚本(使用Chrome或任何其他浏览器)时,这将导致以下错误:-

When I try to run the scripts now (Using Chrome or any other browser.)this results in the following error:-

参数'BROWSER'是方法addFields上的@Test必需的,但尚未标记为@Optional或已定义 在C:\ Users \ li010ca \ AppData \ Local \ Temp \ testng-eclipse--942362152 \ testng-customsuite.xml]]>

MY TESTNG.xml看起来像:-

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>

我已更新为使用最新的Chromedriver.最近是否有其他更改可能导致了此问题?请有人帮忙吗? 谢谢您的帮助.

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.

推荐答案

当您将eclipse用作单个测试时,testng套件级别的参数仅用于创建自定义testng套件.因此,您需要在测试标签之外声明参数.否则,您需要通过右键单击xml文件然后单击以testng套件运行"来运行.

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.

这篇关于参数BROWSER缺少通过TestNG和Eclipse运行Webdriver的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆