博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
关于项目自动化测试架构的改良计划 - DataProviderEngine架构
阅读量:5925 次
发布时间:2019-06-19

本文共 2400 字,大约阅读时间需要 8 分钟。

为了基于上文我们的xml文件的架构,对其进行解析,我自己写了一个DataProviderEngine作为解析xml文件的引擎,它主要的架构如下图:

具体细节如下,为了节省时间,我直接复制我的英文邮件内容了:

Step 1: The XMLReader read the raw test suite xml file (now we adopt the xml file ,since it is not binary file and easy to edit and version control)

Step 2: After reading ,XMLReader store the xml string into a string variable named “ originalXmlString “, this is our starting point.

Step 3: The XIncludeConverter read the originalXmlString ,and resolve the XInclude namespace ,when it resolve this file ,it will replace all the <xi:include href> element with the actual xml fragments one by one.

Step 4: After replacing all <xi:include> ,XIncludeConverter will store the new xml string into string variable named “convertedXmlString”.

Step 5: The XMLManipulator read the convertedXmlString ,and remove all the user configuration part from such as  <add_elements>,<update_elements>,<remove_elements> ,since these information is used for letting test case end user configure how to operate the base data to meet special requirements,so these part shouldn’t exist in final data.

Step 6:After removing all config elements ,The XMLManipulator store the xml string into a new string variable named “ removeAllConfXmlString”

Step 7:Since the configuration information are removed in Step 5-6 ,but they still exist in original xml string ,so XMLModifyInfoExtractor read all the <add_elements>,<update_elements>,<remove_elements> part from original xml string ,and smartly match which corresponding testcase data it will operate .

Step 8:After analyzing all the user modification requirement ,the XMLModifyInfoExtractor store these modification info into 3 arraylists , addElementInfoList,updateElementInfoList,removeElementInfoList.

Step 9:Now it is time to begin modifying the xml ,so the XMLManipulator read the “removeAllConfXmlString”  in Step 6 .

Step 10:Then  XMLManipulator  use all the modification info in Step 8 ,and do modification operation one by one : addElementToXML() ,updateElementFromXML(),removeElementFromXML()

Step 11: after finish all the modification ,XMLManipulator store the final xml string into string variable named “modifiedXmlString”

Step 12: Finally it convert the xml formatted string to a jsonobject and it now can be used as a data provider which can be consumed in each test case.

本文转自 charles_wang888 51CTO博客,原文链接:http://blog.51cto.com/supercharles888/1221708,如需转载请自行联系原作者
你可能感兴趣的文章
私活利器,docker快速部署node.js应用
查看>>
2018第51周日
查看>>
Process of knowledge discovery in databases
查看>>
C#中字符串的内存分配与驻留池
查看>>
Cowboy 源码分析(十八)
查看>>
SharePoint 2007 "Select People and Groups"中搜索不到其他Domain账户的问题[已解决]
查看>>
cas 资源
查看>>
理中汤治疗口疮
查看>>
黄聪:wordpress如何开启文章格式post format
查看>>
Android文件Apk下载变ZIP压缩包解决方案
查看>>
[转载]Android Layout标签之-viewStub,requestFocus,merge,include
查看>>
Android菜单详解——理解android中的Menu
查看>>
[原] jQuery EasyUI 1.2.6源码、Demo合集、离线API
查看>>
view 背景透明
查看>>
基于mini2440的ov9650摄像头裸机测试
查看>>
HDU1702:ACboy needs your help again!
查看>>
对象androidandroid 开发中 如何取得ListView 的 每条Item 的对象
查看>>
怎样维护成功的开源项目
查看>>
mysql服务的启动和停止 net stop mysql net start mysql
查看>>
透过表象看本质!?之二数据拟合
查看>>