摘要: 学习python也有一段时间,当初学的时候就是因为找不到什么有效方法来实现一个通用的协议测试工具.实际场景如下:针对服务器与客户端通讯的私有协议(一般为二进制流),通常彼此的调试需要花费好些时间,且两方面都需要有专人参与,费时费力,当时就设想,能否做一个通用工具,通过xml配置协议结构,初始值,进行自动测试呢.原先有同事进行过这方面的探索,用C++实现了一个协议测试工具,感觉工作量比较大,且通用性比较差,将其用到另一个私有协议,需要改动太多的代码.当时就在考虑用C++编写是否合适,后来在网上搜索,发现python开发效率很高,且没有类型申明的麻烦,最重要的是可以边解释,边执行,当时就在想,是否 阅读全文
posted @ 2012-07-23 14:20 绿色的麦田 阅读(1579) 评论(1) 推荐(0) 编辑
摘要: 由于项目进入尾声,需要进行性能测试,没有专业的性能测试工程师,只好自己动手,研究一下loadrunner.发现loadrunner对web测试介绍比较多,牵涉到winsocket测试的资料极少,不过到处找一找,研究一下,也是可行的.先说一下我们的协议,采用tcp协议,与客户端采用自定义二进制流的方式进行通信.遵从普通的自定义协议的方式,即协议结构采用包头+包体的形式,包头为固定大小的长度,并在包头中加入包体总长度的字段.好了,下面可以用loadrunner进行协议测试了.首先想法在PC上实现一个简单的协议生成软件,我采用python进行编制,将协议跑一遍,然后用loadrunner进行录制.由 阅读全文
posted @ 2012-07-14 15:56 绿色的麦田 阅读(1348) 评论(0) 推荐(0) 编辑
摘要: 今天随意检查一下wing ide更新,发现又出新版本了4.1.7,下来后用4.1.6的破解文件abstract.pyo替换之,发现破解成功,高兴之余,看到source assistant居然还是乱码,想着白升级了,然后到网上找方法,居然找着了。网址如下:http://blog.csdn.net/hairui/article/details/5443356将“C:/Program Files/Wing IDE 4.1/bin/gtk-bin/etc/pango>” 目录中的 pango.aliases 文件改成courier = "yahei consolas hybrid&qu 阅读全文
posted @ 2012-07-10 11:29 绿色的麦田 阅读(1244) 评论(0) 推荐(0) 编辑
摘要: 由于wx还不支持python3.0,只能把python倒回去2.7,幸好3.0写的代码在2.7下基本都可用。 这儿有个入门网址,值得一看。http://www.cnblogs.com/coderzh/archive/2008/11/23/1339310.html 下载完支持2.7的wxpython后,就可以写代码了,和之前写命令行的python基本一样, 只是引入的文件不一样而已,最简单的代码如下... 阅读全文
posted @ 2012-07-01 00:00 绿色的麦田 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 正则表达式比较复杂,前段时间花了一些时间研究,但一直没能与实际工作结合起来,这几天修改配置文件,因牵涉的文件极其多,逐个修改工作量很大,便考虑写个工具,以后再改就方便了很多,结果就被正则表达式给难住了,原来[]符号在正则中是有特别用处的,一时疏忽,结果搞了好久。 解决的问题如下:程序搜索某个目录下的配置文件,找到后将配置文件的某个session下的列表替换掉。 打算分三步走 1、建立函数repla... 阅读全文
posted @ 2012-06-27 19:34 绿色的麦田 阅读(924) 评论(0) 推荐(0) 编辑
摘要: 迭代测试边界条件Testing corner cases by iterationWhile developing code, new corner case inputs are often discovered. Being able to capturethese inputs in an iterable array makes it easy to add related test methods.1. Create a new file called recipe10.py in which to put all our code for this recipe.2. Pick a 阅读全文
posted @ 2012-06-24 21:05 绿色的麦田 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 测试边界条件Testing the edgesWhen we write automated tests, we pick the inputs and assert the expected outputs. It isimportant to test the limits of the inputs to make sure our code can handle good and badinputs. This is also known as testing corner cases.1. Create a new file named recipe9.py in which to 阅读全文
posted @ 2012-06-24 20:53 绿色的麦田 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 将晦涩难懂的测试分解成简单的测试本篇的目的是解说晦涩的测试不易一目了然,然后用一个例子将晦涩的测试用例化为简单的测试用例,使得测试结果一目了然。Breaking down obscure tests into simple ones.Unittest provides the means to test the code through a series of assertions. I have often feltthe temptation to exercise many aspects of a particular piece of code within a single tes 阅读全文
posted @ 2012-06-24 20:39 绿色的麦田 阅读(331) 评论(0) 推荐(0) 编辑
摘要: 重组旧的测试代码,使用场景,之前有一段未使用unittest的测试代码,通过另一个包装文件使其运作起来,日常生活中极少用到。Retooling old test code to run inside unittest.Sometimes, we may have developed demo code to exercise our system. We don't have torewrite it to run it inside unittest. Instead, it is easy to hook it up to the test framework and runit 阅读全文
posted @ 2012-06-24 20:21 绿色的麦田 阅读(460) 评论(0) 推荐(0) 编辑
摘要: 在测试模块中定义测试套件Defining test suites inside the test module.Each test module can provide one or more methods that define a different test suite. Onemethod can exercise all the tests in a given module; another method can define a particularsubset.1. Create a new file called recipe6.py in which to put our 阅读全文
posted @ 2012-06-24 19:11 绿色的麦田 阅读(286) 评论(0) 推荐(0) 编辑