关闭

简单的性能自动化测试架构设计和实现(pylot)-python

发表于:2013-5-17 14:59

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:waterxi(cnblogs)    来源:51Testing软件测试网采编

  目的:

  和普通性能自动化测试工具相似,创建给定数量的请求代理,对链接列表中的链接不断发送请求,并收集请求时间和其他响应信息,最终返回结果数据。

  事实上,由于开源测试项目pylot的思路和这个项目有些相似,大部分示例代码使用pylot源码,一些会有稍微改动。

  设计思路:

  如设计图所示,总体上分为5个主要部分:

  1、Test.xml处理部分:

  通过用户的制作的testcase.xml文件,获取总体的属性值作为参数,并读取所有test case所包含的信息,获取所有测试连接列表和其他配置数据,testcase.xml的格式如下,这个testcase.xml可以专门写一个xml写作的工具,供QA人员以界面方式进行编写,提高效率并减小错误率:

 <testcases>
 
 <project>
         <name>Test</name>
         <description>Only Test</description>
         <executor>zhangyi</executor>
         <!-- 如果需要结果进入数据库,配置下面数据库链接参数 ->
         <DB
 <host></host>
 <port></port>
 <user></user>
 <pwd></pwd>
 <db></db>
 <debug>true</debug>
 </DB>
 <type>Example</type>
         </project>
 <property>
 <old_version></old_verstion>
 <old_version></old_verstion>
 <wel_url>r'http://www.baidu.cn/'</wel_url>
 </property>
 <!-- run before all testcase -->
 <beforesetup>
 </beforesetup>
 <!-- run after all testcase -->
 <afterteardown>
 </afterteardown>  
 <!-- run before each testcase. if fail, not continue run testcase-->
 <setup>
 </setup>
 <!-- run after each testcase. ignore testcase fail.  -->
 <teardown>
 </teardown>
     <!-- SAMPLE TEST CASE -->
     <case repeat=3>
         <url>http://www.example.com</url>
     </case>
     <case repeat=3>
         <url>http://search.yahooapis.com/WebSearchService/V1/webSearch</url>
         <method>POST</method>
         <body><![CDATA[appid=YahooDemo&query=pylot]]></body>
         <add_header>Content-type: application/x-www-form-urlencoded</add_header>
     </case>
     <case repeat=2>
         <url>http://search.yahooapis.com/WebSearchService/V1/webSearch</url>
         <method>POST</method>
         <body><![CDATA[appid=YahooDemo&query=pylot]]></body>
         <add_header>Content-type: application/x-www-form-urlencoded</add_header>
     </case repeat=3>
     <case>
         <url>http://search.yahooapis.com/WebSearchService/V1/webSearch</url>
         <method>POST</method>
         <body><![CDATA[appid=YahooDemo&query=pylot]]></body>
         <add_header>Content-type: application/x-www-form-urlencoded</add_header>
     </case>
     <case>
         <url>http://www.example.com</url>
     </case>
     <case repeat=10>
         <url>http://www.example.com</url>
     </case>
     <!-- SAMPLE TEST CASE -->
     <!--
     <case>
         <url>http://search.yahooapis.com/WebSearchService/V1/webSearch</url>
         <method>POST</method>
         <body><![CDATA[appid=YahooDemo&query=pylot]]></body>
         <add_header>Content-type: application/x-www-form-urlencoded</add_header>
     </case>
     -->
 </testcases>

51/512345>
《2023软件测试行业现状调查报告》独家发布~

精彩评论

  • zdlhappy
    2014-5-09 09:43:23

    请教一个问题,我装好了所有需要装的,但是result.html上还是没有图片,日志里也没报错,请大神指点!!

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号