selenium读取xml
try{
File f = new File("TestPlan.xml");
SAXReader reader = new SAXReader();
Document doc = reader.read(f);
Element root = doc.getRootElement();
Element e = null;
e = root.element("TestServer");
hTestServer.serverName = e.elementTextTrim("ServerName");
hTestServer.port = Integer.parseInt(e.elementTextTrim("Port"));
hdefaultTimeOut = e.elementTextTrim("DefaultTimeOut");
for (Iterator i = root.elementIterator("Site"); i.hasNext();){
e = (Element)i.next();
hSiteList.add(new TestSite(e.elementTextTrim("baseURL"), e.elementTextTrim("initPath"), Boolean.parseBoolean(e.elementTextTrim("Enable"))));
}
for (Iterator i = root.elementIterator("TestCase"); i.hasNext();){
e = (Element)i.next();
hTestCaseList.add(new Case(e.elementTextTrim("Name"), Boolean.parseBoolean(e.elementTextTrim("Enable"))));
}
}
catch(Exception e)
{
e.printStackTrace();
}
摘自 移动互联性能、android自动化、web自动化测试专栏
补充:综合编程 , 其他综合 ,