我已经配置了testng.xml文件以在不同的浏览器中运行回归组.Below是相同的testng.xml代码。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="SeleniumSuite" verbose ="1" thread-count = "1" parallel="false">
<**test** name="FirefoxTest">
<groups>
<run>
<include name="Regression"></include>
</run>
</groups>
<parameter name="browser" value="firefox" />
<classes>
<class name="Testscript.Program111_RediffLogin" />
</classes>
</test>
<test name="IETest">
<groups>
<run>
<include name="Regression"></include>
</run>
</groups>
<parameter name="browser" value="ie" />
<classes>
<class name="Testscript.Program111_RediffLogin" />
</classes>
</test>
</suite>
当我将鼠标悬停在标签上时,它会显示一条错误消息“元素类型的内容”test“必须匹配”(方法选择器?,参数*,组?,包?,类? )“。在Test类级别,我已经正确定义了所有参数,以便运行回归测试。但是我仍然看到testng.xml文件中的错误。任何人都可以查看这个并帮助我!
请找到我用于自动化的测试用例
@Test(groups={"Regression"},dataProvider = "hashmapdataprovider",dataProviderClass =Dataprovider.Dataprovider_Hashmap.class,priority=1 )
public void validLogin(Map<String,String> hm) throws IOException
{
pageobjects.Signin();
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
OriginalExcelRW Excel = new OriginalExcelRW("F:\\anand_acer\\selenium\\rediffbooks.xlsx");
XSSFSheet s1 = Excel.Setsheet("Sheet1");
SoftAssert s_assert = new SoftAssert();
if (hm.get("Executionflow").contains("anand"))
{
pageobjects.Username1(hm.get(Excel.Readvalue(s1, 0, 2)));
pageobjects.pass1(hm.get(Excel.Readvalue(s1, 0, 3)));
//s_assert.assertEquals(hm.get(Excel.Readvalue(s1, 0, 2)), hm.get(Excel.Readvalue(s1, 0, 3)), "both the usssser Ideee and password doesnt matches");
//logger.info("Usssser Ideeee");
pageobjects.login();
s_assert.assertTrue(true, "login success");
//logger.info("The login was success");
System.out.println("Valid login is passed");
pageobjects.signout();
pageobjects.Signin();
//pageobjects.cleartext();
}
s_assert.assertAll();
}
答案 0 :(得分:1)
从您发布的错误消息看起来,它们必须采用特殊的缩进顺序?
以下是我的XML的一个例子
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite verbose="1" name="example suite 1">
<listeners>
<listener class-name="ReportListener.ReportListenerClass" />
</listeners>
<test name="Logout tests">
<classes>
<class name="com.emc.qe.u360.tests.LogoutTests" />
</classes>
</test>
<test name="Login tests">
<classes>
<class name="com.emc.qe.u360.tests.LoginPageTests" />
</classes>
</test>
</suite>