RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
关于项目自动化测试架构的改良计划-去除动作指令

因为我们在test_suite.xml中定义了多个动作指令,比如,等,他们指示让我们Engine来对最终数据进行操作,这些动作指令不是数据,因此,他们并不包含在我们最终的数据结果集中,所以我们必须对他们进行移除。所以我们用以下代码来进行移除工作:

网站建设哪家好,找创新互联建站!专注于网页设计、网站建设、微信开发、微信小程序定制开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了依安免费建站欢迎大家使用!

public class XMLManipulator {
                
    public static String removeModifyConfFromXML(String xmlString) throws Exception{
        Document doc = null;
        doc = DocumentHelper.parseText(xmlString);
                
        //remove the  from the target xml
        List addPart = doc.selectNodes("/test_suite/test_case/add_elements");
        for(Node node: addPart){
            node.getParent().remove(node);
        }
                    
        //remove the  from the target xml
        List updatePart = doc.selectNodes("/test_suite/test_case/update_elements");
        for(Node node: updatePart){
                    node.getParent().remove(node);
        }
                    
        //remove the  from the target xml
        List removePart = doc.selectNodes("/test_suite/test_case/remove_elements");
        for(Node node: removePart){
            node.getParent().remove(node);
        }
                    
        //find document again
                    
        return doc.asXML();
                    
    }
                
..
}

这样最终的xml文件就不包含这些动作指令的代码片段了。


标题名称:关于项目自动化测试架构的改良计划-去除动作指令
URL网址:http://scyingshan.cn/article/jsiohh.html