<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>进化的测试</title>
	<atom:link href="http://magustest.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://magustest.com/blog</link>
	<description>关注软件测试，白盒测试，自动化测试，性能测试</description>
	<lastBuildDate>Wed, 02 Jun 2010 16:12:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>代码中的注释</title>
		<link>http://magustest.com/blog/computer/code-comment/</link>
		<comments>http://magustest.com/blog/computer/code-comment/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 16:12:11 +0000</pubDate>
		<dc:creator>magus</dc:creator>
				<category><![CDATA[计算机技术]]></category>
		<category><![CDATA[概念术语]]></category>

		<guid isPermaLink="false">http://magustest.com/blog/?p=661</guid>
		<description><![CDATA[我第一个实习的公司，是一个美资公司，在印度设立研发中心可能都已经有超过10年的经验了，那时候一些前辈们告诉我，印度人写的代码可能不如中国人那么聪明，但是他们的注释实在是非常详细，有时候甚至达到了1:1的比例，试想想，100行代码就有100行注释，这是多么的恐怖啊。 经常听到会有人抱怨道，怎么这段代码没有注释啊，这是为什么这样写的啊，如此云云。仿佛没有注释，这个世界就不转了。类似的事情也经常发生在QA们的身边，只不过注释换成了文档。 刚毕业的时候做白盒测试，现在回想起来，那时候的我测试的代码大部分都是不包含注释的，不过我测试起来并没有太大的困难，总结一下，应该有以下几点原因： 有意义的函数名、变量名。函数的命名让人一看就大概知道在做什么，例如PostBlog就是发布一篇博客，如果遇到一个叫SaveProfile的方法但做的却是加好友，那我想再多的注释我也会头晕 代码不会说谎。根据经验，如果一段代码理解起来很费劲，那么通常里面都会隐藏着问题。代码就是最好的注释，一些过时的注释，设置会对阅读代码的人产生误导 充分的沟通。虽然游走于几个项目组，跟不同的开发人员打交道，但是每当遇到问题的时候总会主动跟相关的人沟通，一个活生生的人坐在那里不问，却迷信什么文档，这真是本末倒置 注释，能不写就别写，实在要写，写WHY而不是WHAT。 联系一下最近在Team内写的一个新的回归测试工具，里面基本没有注释，希望过几个月以后，自己还能够看看代码就知道当时那段代码为什么这样写。 Share and Enjoy: No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>我第一个实习的公司，是一个美资公司，在印度设立研发中心可能都已经有超过10年的经验了，那时候一些前辈们告诉我，印度人写的代码可能不如中国人那么聪明，但是他们的注释实在是非常详细，有时候甚至达到了1:1的比例，试想想，100行代码就有100行注释，这是多么的恐怖啊。</p>
<p>经常听到会有人抱怨道，怎么这段代码没有注释啊，这是为什么这样写的啊，如此云云。仿佛没有注释，这个世界就不转了。类似的事情也经常发生在QA们的身边，只不过注释换成了文档。</p>
<p>刚毕业的时候做白盒测试，现在回想起来，那时候的我测试的代码大部分都是不包含注释的，不过我测试起来并没有太大的困难，总结一下，应该有以下几点原因：</p>
<ol>
<li>有意义的函数名、变量名。函数的命名让人一看就大概知道在做什么，例如PostBlog就是发布一篇博客，如果遇到一个叫SaveProfile的方法但做的却是加好友，那我想再多的注释我也会头晕</li>
<li>代码不会说谎。根据经验，如果一段代码理解起来很费劲，那么通常里面都会隐藏着问题。代码就是最好的注释，一些过时的注释，设置会对阅读代码的人产生误导</li>
<li>充分的沟通。虽然游走于几个项目组，跟不同的开发人员打交道，但是每当遇到问题的时候总会主动跟相关的人沟通，一个活生生的人坐在那里不问，却迷信什么文档，这真是本末倒置</li>
</ol>
<p>注释，能不写就别写，实在要写，写WHY而不是WHAT。</p>
<p>联系一下最近在Team内写的一个新的回归测试工具，里面基本没有注释，希望过几个月以后，自己还能够看看代码就知道当时那段代码为什么这样写。</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://magustest.com/blog/feed/" title="RSS"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fcode-comment%2F&amp;title=%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E6%B3%A8%E9%87%8A&amp;annotation=%E6%88%91%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%AE%9E%E4%B9%A0%E7%9A%84%E5%85%AC%E5%8F%B8%EF%BC%8C%E6%98%AF%E4%B8%80%E4%B8%AA%E7%BE%8E%E8%B5%84%E5%85%AC%E5%8F%B8%EF%BC%8C%E5%9C%A8%E5%8D%B0%E5%BA%A6%E8%AE%BE%E7%AB%8B%E7%A0%94%E5%8F%91%E4%B8%AD%E5%BF%83%E5%8F%AF%E8%83%BD%E9%83%BD%E5%B7%B2%E7%BB%8F%E6%9C%89%E8%B6%85%E8%BF%8710%E5%B9%B4%E7%9A%84%E7%BB%8F%E9%AA%8C%E4%BA%86%EF%BC%8C%E9%82%A3%E6%97%B6%E5%80%99%E4%B8%80%E4%BA%9B%E5%89%8D%E8%BE%88%E4%BB%AC%E5%91%8A%E8%AF%89%E6%88%91%EF%BC%8C%E5%8D%B0%E5%BA%A6%E4%BA%BA%E5%86%99%E7%9A%84%E4%BB%A3%E7%A0%81%E5%8F%AF%E8%83%BD%E4%B8%8D%E5%A6%82%E4%B8%AD%E5%9B%BD%E4%BA%BA%E9%82%A3%E4%B9%88%E8%81%AA%E6%98%8E%EF%BC%8C%E4%BD%86%E6%98%AF%E4%BB%96%E4%BB%AC%E7%9A%84%E6%B3%A8%E9%87%8A%E5%AE%9E%E5%9C%A8%E6%98%AF%E9%9D" title="Google Bookmarks"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fcode-comment%2F&amp;title=%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E6%B3%A8%E9%87%8A&amp;bodytext=%E6%88%91%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%AE%9E%E4%B9%A0%E7%9A%84%E5%85%AC%E5%8F%B8%EF%BC%8C%E6%98%AF%E4%B8%80%E4%B8%AA%E7%BE%8E%E8%B5%84%E5%85%AC%E5%8F%B8%EF%BC%8C%E5%9C%A8%E5%8D%B0%E5%BA%A6%E8%AE%BE%E7%AB%8B%E7%A0%94%E5%8F%91%E4%B8%AD%E5%BF%83%E5%8F%AF%E8%83%BD%E9%83%BD%E5%B7%B2%E7%BB%8F%E6%9C%89%E8%B6%85%E8%BF%8710%E5%B9%B4%E7%9A%84%E7%BB%8F%E9%AA%8C%E4%BA%86%EF%BC%8C%E9%82%A3%E6%97%B6%E5%80%99%E4%B8%80%E4%BA%9B%E5%89%8D%E8%BE%88%E4%BB%AC%E5%91%8A%E8%AF%89%E6%88%91%EF%BC%8C%E5%8D%B0%E5%BA%A6%E4%BA%BA%E5%86%99%E7%9A%84%E4%BB%A3%E7%A0%81%E5%8F%AF%E8%83%BD%E4%B8%8D%E5%A6%82%E4%B8%AD%E5%9B%BD%E4%BA%BA%E9%82%A3%E4%B9%88%E8%81%AA%E6%98%8E%EF%BC%8C%E4%BD%86%E6%98%AF%E4%BB%96%E4%BB%AC%E7%9A%84%E6%B3%A8%E9%87%8A%E5%AE%9E%E5%9C%A8%E6%98%AF%E9%9D" title="Digg"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fcode-comment%2F&amp;title=%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E6%B3%A8%E9%87%8A&amp;notes=%E6%88%91%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%AE%9E%E4%B9%A0%E7%9A%84%E5%85%AC%E5%8F%B8%EF%BC%8C%E6%98%AF%E4%B8%80%E4%B8%AA%E7%BE%8E%E8%B5%84%E5%85%AC%E5%8F%B8%EF%BC%8C%E5%9C%A8%E5%8D%B0%E5%BA%A6%E8%AE%BE%E7%AB%8B%E7%A0%94%E5%8F%91%E4%B8%AD%E5%BF%83%E5%8F%AF%E8%83%BD%E9%83%BD%E5%B7%B2%E7%BB%8F%E6%9C%89%E8%B6%85%E8%BF%8710%E5%B9%B4%E7%9A%84%E7%BB%8F%E9%AA%8C%E4%BA%86%EF%BC%8C%E9%82%A3%E6%97%B6%E5%80%99%E4%B8%80%E4%BA%9B%E5%89%8D%E8%BE%88%E4%BB%AC%E5%91%8A%E8%AF%89%E6%88%91%EF%BC%8C%E5%8D%B0%E5%BA%A6%E4%BA%BA%E5%86%99%E7%9A%84%E4%BB%A3%E7%A0%81%E5%8F%AF%E8%83%BD%E4%B8%8D%E5%A6%82%E4%B8%AD%E5%9B%BD%E4%BA%BA%E9%82%A3%E4%B9%88%E8%81%AA%E6%98%8E%EF%BC%8C%E4%BD%86%E6%98%AF%E4%BB%96%E4%BB%AC%E7%9A%84%E6%B3%A8%E9%87%8A%E5%AE%9E%E5%9C%A8%E6%98%AF%E9%9D" title="del.icio.us"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fcode-comment%2F&amp;t=%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E6%B3%A8%E9%87%8A" title="Facebook"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fcode-comment%2F&title=%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E6%B3%A8%E9%87%8A" title="豆瓣"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban.png" title="豆瓣" alt="豆瓣" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fcode-comment%2F&title=%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E6%B3%A8%E9%87%8A&n=1" title="豆瓣九点"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban9.png" title="豆瓣九点" alt="豆瓣九点" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.friendfeed.com/share?title=%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E6%B3%A8%E9%87%8A&amp;link=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fcode-comment%2F" title="FriendFeed"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fcode-comment%2F&amp;title=%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E6%B3%A8%E9%87%8A" title="Live"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fcode-comment%2F&amp;title=%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E6%B3%A8%E9%87%8A&amp;body=%E6%88%91%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%AE%9E%E4%B9%A0%E7%9A%84%E5%85%AC%E5%8F%B8%EF%BC%8C%E6%98%AF%E4%B8%80%E4%B8%AA%E7%BE%8E%E8%B5%84%E5%85%AC%E5%8F%B8%EF%BC%8C%E5%9C%A8%E5%8D%B0%E5%BA%A6%E8%AE%BE%E7%AB%8B%E7%A0%94%E5%8F%91%E4%B8%AD%E5%BF%83%E5%8F%AF%E8%83%BD%E9%83%BD%E5%B7%B2%E7%BB%8F%E6%9C%89%E8%B6%85%E8%BF%8710%E5%B9%B4%E7%9A%84%E7%BB%8F%E9%AA%8C%E4%BA%86%EF%BC%8C%E9%82%A3%E6%97%B6%E5%80%99%E4%B8%80%E4%BA%9B%E5%89%8D%E8%BE%88%E4%BB%AC%E5%91%8A%E8%AF%89%E6%88%91%EF%BC%8C%E5%8D%B0%E5%BA%A6%E4%BA%BA%E5%86%99%E7%9A%84%E4%BB%A3%E7%A0%81%E5%8F%AF%E8%83%BD%E4%B8%8D%E5%A6%82%E4%B8%AD%E5%9B%BD%E4%BA%BA%E9%82%A3%E4%B9%88%E8%81%AA%E6%98%8E%EF%BC%8C%E4%BD%86%E6%98%AF%E4%BB%96%E4%BB%AC%E7%9A%84%E6%B3%A8%E9%87%8A%E5%AE%9E%E5%9C%A8%E6%98%AF%E9%9D" title="Ping.fm"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E6%B3%A8%E9%87%8A&uri=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fcode-comment%2F" title="QQ书签"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E6%B3%A8%E9%87%8A%20-%20http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fcode-comment%2F" title="Twitter"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://magustest.com/blog/computer/code-comment/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>DSL与自动化测试 &#8211; 用Python实现简单的DSL</title>
		<link>http://magustest.com/blog/automationtesting/dsl-automation-testing-using-python/</link>
		<comments>http://magustest.com/blog/automationtesting/dsl-automation-testing-using-python/#comments</comments>
		<pubDate>Sat, 03 Apr 2010 06:15:32 +0000</pubDate>
		<dc:creator>magus</dc:creator>
				<category><![CDATA[自动化测试]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://magustest.com/blog/?p=655</guid>
		<description><![CDATA[自动化测试，一个在测试领域中被广为熟知，也是被谈论最多的概念之一。DSL (Domain Specific Language)，一种高度抽象，用于某个特定领域下编程语言。软件测试在大多数情况下都是对某个特定行业的软件系统进行测试，所以这两者应该可以很好的结合起来，事实上也是这样的，QTP里面的keyword view，其实就是DSL的一个实现。DSL一般可以分为两个大的类型，分别是External DSL 和 Internal DSL （引用自Martin Fowler）。External DSL 一般来说是跟其实现语言不一样的 DSL，常见的External DSL 有：SQL和XML配置文件；而Internal DSL 一般来说就是该DSL使用某个现成的编程语言（就是所谓的host language)，然后对host language进行一些改造而成。 我们在测试中会遇到很多问题，其中一些问题，几乎是所有公司所有团队都会遇到的，例如测试覆盖率不够，测试的时间不够等等。面对这些问题，自动化测试自然而然地成为解决这些问题的首选方法。但是自动化测试真的就是银弹麽？不见得！以前曾经在ASP.NET QA 的博客中给他们留言，请教过关于自动化测试的事情，我记得其中有一个回复是说，在某个release中过度地使用自动化测试，一切东西都想实现自动化测试，而忽略了产品本身的功能、特性的关注，结果就是超高的自动化测试覆盖率，但是很差的产品质量。大家都去实现自动化测试了，谁来做功能点的覆盖呢？某些领域的专家（SME），他们可能对测试技术是一无所知的，要把这些领域专家和测试实施结合起来，DSL就是一个比较好的桥梁。 我在工作中遇到的问题是，我需要测试一个类似UV（独立用户访问数）统计的系统，统计UV的方法其实就是根据_uid cookie的值来判断这个用户在某段时间内访问过我们的系统多少次，访问了哪些站点，进行了什么样的行为。其中有2个地方比较麻烦，第一就是在测试过程中要不断地拷贝cookie，这样拷来拷去两三次以后很容易就混乱，出错；第二就是需要记录访问哪些站点，这些站点都只是ID，也是需要不断地修改请求，测试时间长了也是很容易出错。所以我就打算在原来的测试工具基础上，实现一个简单的Internal DSL。先看成品： @tc def uniq_inventory_case01&#40;&#41;: test= testTool&#40;&#41; test.user&#40;'a'&#41;.view&#40;'asset55100002'&#41;.anetwork&#40;'55100'&#41;.onsite&#40;'site55100503'&#41;.snetwork&#40;'55100'&#41;.dnetwork&#40;'55100'&#41;.times&#40;1&#41;.go&#40;&#41; test.user&#40;'b'&#41;.view&#40;'asset55100002'&#41;.anetwork&#40;'55100'&#41;.onsite&#40;'site55100503'&#41;.snetwork&#40;'55100'&#41;.dnetwork&#40;'55100'&#41;.times&#40;2&#41;.go&#40;&#41; test.user&#40;'b'&#41;.view&#40;'asset55100002'&#41;.anetwork&#40;'55100'&#41;.onsite&#40;'site55100504_noad'&#41;.snetwork&#40;'55100'&#41;.dnetwork&#40;'55100'&#41;.times&#40;4&#41;.go&#40;&#41; 实例化一个testTool对象，然后就是指定哪个用户：user(&#8216;a&#8217;)或者user(&#8216;b&#8217;)，看的视频的ID：view(&#8216;asset55100002&#8242;)，这个视频属于哪个CRO呢？anetwork(&#8217;55100&#8242;)；放在哪个网站呢？onsite(&#8216;site55100503&#8242;)；网站是谁的呢？snetwork(&#8217;55100&#8242;)；谁是分发者呢？dnetwork(&#8217;55100&#8242;)；看了多少次呢？times(4)；最后一个有点儿丑陋的go()。 像这样子一句话里面N个方法连着用，就叫Method Chaining，Method Chaining通常可以让代码变得更加人性化，读起来更加容易。但是使用Method Chaining通常会遇到一个问题，就是很难判断就是到了哪个方法才是终结呢？是不是有些方法的调用是可选的，有些是必选的呢？其中一个解决方法就是我用到的，放一个.go()方法在最后，作为终结方法。要实现Method Chaining，其实只需要顶一个类，对于需要做连接的方法，最后都返回这个类的实例。例如： def view&#40;self, assetid&#41;: if assetid: self.asset_id = assetid return self &#160; def anetwork&#40;self, networkid&#41;: if [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>自动化测试，一个在测试领域中被广为熟知，也是被谈论最多的概念之一。DSL (Domain Specific Language)，一种高度抽象，用于某个特定领域下编程语言。软件测试在大多数情况下都是对某个特定行业的软件系统进行测试，所以这两者应该可以很好的结合起来，事实上也是这样的，QTP里面的keyword view，其实就是DSL的一个实现。DSL一般可以分为两个大的类型，分别是External DSL 和 Internal DSL （引用自Martin Fowler）。External DSL 一般来说是跟其实现语言不一样的 DSL，常见的External DSL 有：SQL和XML配置文件；而Internal DSL 一般来说就是该DSL使用某个现成的编程语言（就是所谓的host language)，然后对host language进行一些改造而成。</p>
<p>我们在测试中会遇到很多问题，其中一些问题，几乎是所有公司所有团队都会遇到的，例如测试覆盖率不够，测试的时间不够等等。面对这些问题，自动化测试自然而然地成为解决这些问题的首选方法。但是自动化测试真的就是银弹麽？不见得！以前曾经在ASP.NET QA 的博客中给他们留言，请教过关于自动化测试的事情，我记得其中有一个回复是说，在某个release中过度地使用自动化测试，一切东西都想实现自动化测试，而忽略了产品本身的功能、特性的关注，结果就是超高的自动化测试覆盖率，但是很差的产品质量。大家都去实现自动化测试了，谁来做功能点的覆盖呢？某些领域的专家（SME），他们可能对测试技术是一无所知的，要把这些领域专家和测试实施结合起来，DSL就是一个比较好的桥梁。</p>
<p>我在工作中遇到的问题是，我需要测试一个类似UV（独立用户访问数）统计的系统，统计UV的方法其实就是根据_uid cookie的值来判断这个用户在某段时间内访问过我们的系统多少次，访问了哪些站点，进行了什么样的行为。其中有2个地方比较麻烦，第一就是在测试过程中要不断地拷贝cookie，这样拷来拷去两三次以后很容易就混乱，出错；第二就是需要记录访问哪些站点，这些站点都只是ID，也是需要不断地修改请求，测试时间长了也是很容易出错。所以我就打算在原来的测试工具基础上，实现一个简单的Internal DSL。先看成品：</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">@tc
<span style="color: #ff7700;font-weight:bold;">def</span> uniq_inventory_case01<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #dc143c;">test</span>= testTool<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #dc143c;">test</span>.<span style="color: #dc143c;">user</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'a'</span><span style="color: black;">&#41;</span>.<span style="color: black;">view</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'asset55100002'</span><span style="color: black;">&#41;</span>.<span style="color: black;">anetwork</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'55100'</span><span style="color: black;">&#41;</span>.<span style="color: black;">onsite</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'site55100503'</span><span style="color: black;">&#41;</span>.<span style="color: black;">snetwork</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'55100'</span><span style="color: black;">&#41;</span>.<span style="color: black;">dnetwork</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'55100'</span><span style="color: black;">&#41;</span>.<span style="color: black;">times</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>.<span style="color: black;">go</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #dc143c;">test</span>.<span style="color: #dc143c;">user</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'b'</span><span style="color: black;">&#41;</span>.<span style="color: black;">view</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'asset55100002'</span><span style="color: black;">&#41;</span>.<span style="color: black;">anetwork</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'55100'</span><span style="color: black;">&#41;</span>.<span style="color: black;">onsite</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'site55100503'</span><span style="color: black;">&#41;</span>.<span style="color: black;">snetwork</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'55100'</span><span style="color: black;">&#41;</span>.<span style="color: black;">dnetwork</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'55100'</span><span style="color: black;">&#41;</span>.<span style="color: black;">times</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>.<span style="color: black;">go</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #dc143c;">test</span>.<span style="color: #dc143c;">user</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'b'</span><span style="color: black;">&#41;</span>.<span style="color: black;">view</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'asset55100002'</span><span style="color: black;">&#41;</span>.<span style="color: black;">anetwork</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'55100'</span><span style="color: black;">&#41;</span>.<span style="color: black;">onsite</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'site55100504_noad'</span><span style="color: black;">&#41;</span>.<span style="color: black;">snetwork</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'55100'</span><span style="color: black;">&#41;</span>.<span style="color: black;">dnetwork</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'55100'</span><span style="color: black;">&#41;</span>.<span style="color: black;">times</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">4</span><span style="color: black;">&#41;</span>.<span style="color: black;">go</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>实例化一个testTool对象，然后就是指定哪个用户：user(&#8216;a&#8217;)或者user(&#8216;b&#8217;)，看的视频的ID：view(&#8216;asset55100002&#8242;)，这个视频属于哪个CRO呢？anetwork(&#8217;55100&#8242;)；放在哪个网站呢？onsite(&#8216;site55100503&#8242;)；网站是谁的呢？snetwork(&#8217;55100&#8242;)；谁是分发者呢？dnetwork(&#8217;55100&#8242;)；看了多少次呢？times(4)；最后一个有点儿丑陋的go()。</p>
<p>像这样子一句话里面N个方法连着用，就叫Method Chaining，Method Chaining通常可以让代码变得更加人性化，读起来更加容易。但是使用Method Chaining通常会遇到一个问题，就是很难判断就是到了哪个方法才是终结呢？是不是有些方法的调用是可选的，有些是必选的呢？其中一个解决方法就是我用到的，放一个.go()方法在最后，作为终结方法。要实现Method Chaining，其实只需要顶一个类，对于需要做连接的方法，最后都返回这个类的实例。例如：</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> view<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, assetid<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> assetid:     <span style="color: #008000;">self</span>.<span style="color: black;">asset_id</span> = assetid
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> anetwork<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, networkid<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> networkid:   <span style="color: #008000;">self</span>.<span style="color: black;">a_network_id</span> = networkid
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> snetwork<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, networkid<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> networkid:   <span style="color: #008000;">self</span>.<span style="color: black;">s_network_id</span> = networkid
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> dnetwork<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, networkid<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> networkid:   <span style="color: #008000;">self</span>.<span style="color: black;">d_network_id</span> = networkid
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> onsite<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, sectionid<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> sectionid:   <span style="color: #008000;">self</span>.<span style="color: black;">site_section_id</span> = sectionid
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> times<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, times<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> times<span style="color: #66cc66;">&gt;</span><span style="color: #ff4500;">0</span>:       <span style="color: #008000;">self</span>.<span style="color: black;">request_times</span> = times
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span></pre></div></div>

<p>最后一个终结方法go()，就做真正的处理</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> go<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">self</span>.<span style="color: black;">asset_id</span> <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #008000;">self</span>.<span style="color: black;">site_section_id</span> <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #008000;">self</span>.<span style="color: black;">times</span> <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #008000;">self</span>.<span style="color: black;">a_network_id</span> <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #008000;">self</span>.<span style="color: black;">s_network_id</span>:
        <span style="color: #008000;">self</span>.<span style="color: black;">prepareRequest</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">request_times</span><span style="color: black;">&#41;</span>:
            <span style="color: #008000;">self</span>.<span style="color: black;">sendRequest</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
        <span style="color: #008000;">self</span>.<span style="color: black;">cleanup</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        info = <span style="color: #483d8b;">'Required information missing, abort running.'</span>
        <span style="color: #dc143c;">logging</span>.<span style="color: black;">debug</span><span style="color: black;">&#40;</span>info<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">print</span> info</pre></div></div>

<p>如果是实现一个External DSL 的话，的确难度不小；但是Internal DSL其实并不是很高深，也不是很难实现，在它的帮助下，可以把工作完成的更好，对自己以后维护测试用例也带来了不少方便。</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://magustest.com/blog/feed/" title="RSS"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fdsl-automation-testing-using-python%2F&amp;t=DSL%E4%B8%8E%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%20-%20%E7%94%A8Python%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84DSL" title="Facebook"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fdsl-automation-testing-using-python%2F&title=DSL%E4%B8%8E%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%20-%20%E7%94%A8Python%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84DSL" title="豆瓣"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban.png" title="豆瓣" alt="豆瓣" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fdsl-automation-testing-using-python%2F&title=DSL%E4%B8%8E%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%20-%20%E7%94%A8Python%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84DSL&n=1" title="豆瓣九点"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban9.png" title="豆瓣九点" alt="豆瓣九点" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.friendfeed.com/share?title=DSL%E4%B8%8E%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%20-%20%E7%94%A8Python%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84DSL&amp;link=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fdsl-automation-testing-using-python%2F" title="FriendFeed"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fdsl-automation-testing-using-python%2F&amp;title=DSL%E4%B8%8E%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%20-%20%E7%94%A8Python%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84DSL" title="Live"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=DSL%E4%B8%8E%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%20-%20%E7%94%A8Python%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84DSL&uri=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fdsl-automation-testing-using-python%2F" title="QQ书签"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=DSL%E4%B8%8E%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%20-%20%E7%94%A8Python%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84DSL%20-%20http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fdsl-automation-testing-using-python%2F" title="Twitter"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://magustest.com/blog/automationtesting/dsl-automation-testing-using-python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>TestLink不能连接BugZilla的解决办法</title>
		<link>http://magustest.com/blog/softwaretesting/testlink-integrate-bugzilla-failed/</link>
		<comments>http://magustest.com/blog/softwaretesting/testlink-integrate-bugzilla-failed/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 15:57:04 +0000</pubDate>
		<dc:creator>magus</dc:creator>
				<category><![CDATA[软件测试]]></category>
		<category><![CDATA[BugZilla]]></category>
		<category><![CDATA[TestLink]]></category>

		<guid isPermaLink="false">http://magustest.com/blog/?p=652</guid>
		<description><![CDATA[TestLink是一个基于Web的PHP开源测试管理系统，虽然用起来跟QC那些商业软件比起来不是那么爽，但是由于是开源、免费，所以越来越多的公司在用TestLink。BugZilla作为老牌的bug管理工具，同样有着很大的用户群。 TestLink有一个BugTracking的接口模块，可以使得TestLink可以与其他BugTracking系统集成。在集成的过程中发现TestLink提示错误：Bug ID does not exist on BTS（中文的话是&#8217;bug的ID在BTS中不存在！&#8217;），找到TestLink的代码文件bugAdd.php，找到下面这段代码块 if&#40;$args-&#62;bug_id != &#34;&#34;&#41; &#123; $msg = lang_get&#40;&#34;error_wrong_BugID_format&#34;&#41;; if &#40;$g_bugInterface-&#62;checkBugID&#40;$args-&#62;bug_id&#41;&#41; &#123; $msg = lang_get&#40;&#34;error_bug_does_not_exist_on_bts&#34;&#41;; // 问题在这里 if &#40;$g_bugInterface-&#62;checkBugID_existence&#40;$args-&#62;bug_id&#41;&#41; &#123; if &#40;write_execution_bug&#40;$db,$args-&#62;exec_id, $args-&#62;bug_id&#41;&#41; &#123; $msg = lang_get&#40;&#34;bug_added&#34;&#41;; logAuditEvent&#40;TLS&#40;&#34;audit_executionbug_added&#34;,$args-&#62;bug_id&#41;,&#34;CREATE&#34;,$args-&#62;exec_id,&#34;executions&#34;&#41;; &#125; &#125; &#125; &#125; 问题出在$g_bugInterface->checkBugID_existence($args->bug_id)这个方法中。在、TestLink的int_bugzilla.php文件中，并没有overload这个checkBugID_existence的方法，所以这个方法就会按照int_bugtracking.php中的默认实现，返回false。TestLink就会出现error_bug_does_not_exist_on_bts这个ERROR 解决这个问题很简单，就是在int_bugzilla.php中自己实现checkBugID_existence方法，简单的实现如下： function checkBugID_existence&#40;$id&#41; &#123; $status_ok = 0; //关键是下面这个Query bug id的语句，大家自己看看数据库是哪个表，根据实际情况自己修改 $query = &#34;SELECT bug_id FROM bugs [...]


Related posts:<ol><li><a href='http://magustest.com/blog/uncategorized/stringbuffer-in-lua/' rel='bookmark' title='Permanent Link: 在Lua中实现简单的StringBuffer'>在Lua中实现简单的StringBuffer</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>TestLink是一个基于Web的PHP开源测试管理系统，虽然用起来跟QC那些商业软件比起来不是那么爽，但是由于是开源、免费，所以越来越多的公司在用TestLink。BugZilla作为老牌的bug管理工具，同样有着很大的用户群。</p>
<p>TestLink有一个BugTracking的接口模块，可以使得TestLink可以与其他BugTracking系统集成。在集成的过程中发现TestLink提示错误：Bug ID does not exist on BTS（中文的话是&#8217;bug的ID在BTS中不存在！&#8217;），找到TestLink的代码文件bugAdd.php，找到下面这段代码块</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bug_id</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> lang_get<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;error_wrong_BugID_format&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$g_bugInterface</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">checkBugID</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bug_id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> lang_get<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;error_bug_does_not_exist_on_bts&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// 问题在这里</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$g_bugInterface</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">checkBugID_existence</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bug_id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span> 	  
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>write_execution_bug<span style="color: #009900;">&#40;</span><span style="color: #000088;">$db</span><span style="color: #339933;">,</span><span style="color: #000088;">$args</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">exec_id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bug_id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> lang_get<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;bug_added&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				logAuditEvent<span style="color: #009900;">&#40;</span>TLS<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;audit_executionbug_added&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$args</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bug_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;CREATE&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$args</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">exec_id</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;executions&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>问题出在$g_bugInterface->checkBugID_existence($args->bug_id)这个方法中。在、TestLink的int_bugzilla.php文件中，并没有overload这个checkBugID_existence的方法，所以这个方法就会按照int_bugtracking.php中的默认实现，返回false。TestLink就会出现error_bug_does_not_exist_on_bts这个ERROR</p>
<p>解决这个问题很简单，就是在int_bugzilla.php中自己实现checkBugID_existence方法，简单的实现如下：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> checkBugID_existence<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$status_ok</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//关键是下面这个Query bug id的语句，大家自己看看数据库是哪个表，根据实际情况自己修改	</span>
	<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT bug_id FROM bugs WHERE bug_id='&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$id</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dbConnection</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">exec_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dbConnection</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$status_ok</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>    
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$status_ok</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>OK。在int_bugzilla.php文件中添加了 checkBugID_existence() 方法后，就可以从TestLink中直接把BugZilla里面的BUG ID和某个测试关联起来了。</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://magustest.com/blog/feed/" title="RSS"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Ftestlink-integrate-bugzilla-failed%2F&amp;title=TestLink%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5BugZilla%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95&amp;annotation=TestLink%E6%98%AF%E4%B8%80%E4%B8%AA%E5%9F%BA%E4%BA%8EWeb%E7%9A%84PHP%E5%BC%80%E6%BA%90%E6%B5%8B%E8%AF%95%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F%EF%BC%8C%E8%99%BD%E7%84%B6%E7%94%A8%E8%B5%B7%E6%9D%A5%E8%B7%9FQC%E9%82%A3%E4%BA%9B%E5%95%86%E4%B8%9A%E8%BD%AF%E4%BB%B6%E6%AF%94%E8%B5%B7%E6%9D%A5%E4%B8%8D%E6%98%AF%E9%82%A3%E4%B9%88%E7%88%BD%EF%BC%8C%E4%BD%86%E6%98%AF%E7%94%B1%E4%BA%8E%E6%98%AF%E5%BC%80%E6%BA%90%E3%80%81%E5%85%8D%E8%B4%B9%EF%BC%8C%E6%89%80%E4%BB%A5%E8%B6%8A%E6%9D%A5%E8%B6%8A%E5%A4%9A%E7%9A%84%E5%85%AC%E5%8F%B8%E5%9C%A8%E7%94%A8TestLink%E3%80%82BugZilla%E4%BD%9C%E4%B8%BA%E8%80%81%E7%89%8C%E7%9A%84bug%E7%AE%A1%E7%90%86%E5%B7%A5%E5%85%B7%EF%BC%8C%E5%90%8C%E6%A0%B7%E6%9C" title="Google Bookmarks"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Ftestlink-integrate-bugzilla-failed%2F&amp;title=TestLink%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5BugZilla%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95&amp;bodytext=TestLink%E6%98%AF%E4%B8%80%E4%B8%AA%E5%9F%BA%E4%BA%8EWeb%E7%9A%84PHP%E5%BC%80%E6%BA%90%E6%B5%8B%E8%AF%95%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F%EF%BC%8C%E8%99%BD%E7%84%B6%E7%94%A8%E8%B5%B7%E6%9D%A5%E8%B7%9FQC%E9%82%A3%E4%BA%9B%E5%95%86%E4%B8%9A%E8%BD%AF%E4%BB%B6%E6%AF%94%E8%B5%B7%E6%9D%A5%E4%B8%8D%E6%98%AF%E9%82%A3%E4%B9%88%E7%88%BD%EF%BC%8C%E4%BD%86%E6%98%AF%E7%94%B1%E4%BA%8E%E6%98%AF%E5%BC%80%E6%BA%90%E3%80%81%E5%85%8D%E8%B4%B9%EF%BC%8C%E6%89%80%E4%BB%A5%E8%B6%8A%E6%9D%A5%E8%B6%8A%E5%A4%9A%E7%9A%84%E5%85%AC%E5%8F%B8%E5%9C%A8%E7%94%A8TestLink%E3%80%82BugZilla%E4%BD%9C%E4%B8%BA%E8%80%81%E7%89%8C%E7%9A%84bug%E7%AE%A1%E7%90%86%E5%B7%A5%E5%85%B7%EF%BC%8C%E5%90%8C%E6%A0%B7%E6%9C" title="Digg"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Ftestlink-integrate-bugzilla-failed%2F&amp;title=TestLink%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5BugZilla%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95&amp;notes=TestLink%E6%98%AF%E4%B8%80%E4%B8%AA%E5%9F%BA%E4%BA%8EWeb%E7%9A%84PHP%E5%BC%80%E6%BA%90%E6%B5%8B%E8%AF%95%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F%EF%BC%8C%E8%99%BD%E7%84%B6%E7%94%A8%E8%B5%B7%E6%9D%A5%E8%B7%9FQC%E9%82%A3%E4%BA%9B%E5%95%86%E4%B8%9A%E8%BD%AF%E4%BB%B6%E6%AF%94%E8%B5%B7%E6%9D%A5%E4%B8%8D%E6%98%AF%E9%82%A3%E4%B9%88%E7%88%BD%EF%BC%8C%E4%BD%86%E6%98%AF%E7%94%B1%E4%BA%8E%E6%98%AF%E5%BC%80%E6%BA%90%E3%80%81%E5%85%8D%E8%B4%B9%EF%BC%8C%E6%89%80%E4%BB%A5%E8%B6%8A%E6%9D%A5%E8%B6%8A%E5%A4%9A%E7%9A%84%E5%85%AC%E5%8F%B8%E5%9C%A8%E7%94%A8TestLink%E3%80%82BugZilla%E4%BD%9C%E4%B8%BA%E8%80%81%E7%89%8C%E7%9A%84bug%E7%AE%A1%E7%90%86%E5%B7%A5%E5%85%B7%EF%BC%8C%E5%90%8C%E6%A0%B7%E6%9C" title="del.icio.us"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Ftestlink-integrate-bugzilla-failed%2F&amp;t=TestLink%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5BugZilla%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95" title="Facebook"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Ftestlink-integrate-bugzilla-failed%2F&title=TestLink%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5BugZilla%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95" title="豆瓣"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban.png" title="豆瓣" alt="豆瓣" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Ftestlink-integrate-bugzilla-failed%2F&title=TestLink%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5BugZilla%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95&n=1" title="豆瓣九点"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban9.png" title="豆瓣九点" alt="豆瓣九点" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.friendfeed.com/share?title=TestLink%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5BugZilla%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95&amp;link=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Ftestlink-integrate-bugzilla-failed%2F" title="FriendFeed"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Ftestlink-integrate-bugzilla-failed%2F&amp;title=TestLink%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5BugZilla%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95" title="Live"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Ftestlink-integrate-bugzilla-failed%2F&amp;title=TestLink%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5BugZilla%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95&amp;body=TestLink%E6%98%AF%E4%B8%80%E4%B8%AA%E5%9F%BA%E4%BA%8EWeb%E7%9A%84PHP%E5%BC%80%E6%BA%90%E6%B5%8B%E8%AF%95%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F%EF%BC%8C%E8%99%BD%E7%84%B6%E7%94%A8%E8%B5%B7%E6%9D%A5%E8%B7%9FQC%E9%82%A3%E4%BA%9B%E5%95%86%E4%B8%9A%E8%BD%AF%E4%BB%B6%E6%AF%94%E8%B5%B7%E6%9D%A5%E4%B8%8D%E6%98%AF%E9%82%A3%E4%B9%88%E7%88%BD%EF%BC%8C%E4%BD%86%E6%98%AF%E7%94%B1%E4%BA%8E%E6%98%AF%E5%BC%80%E6%BA%90%E3%80%81%E5%85%8D%E8%B4%B9%EF%BC%8C%E6%89%80%E4%BB%A5%E8%B6%8A%E6%9D%A5%E8%B6%8A%E5%A4%9A%E7%9A%84%E5%85%AC%E5%8F%B8%E5%9C%A8%E7%94%A8TestLink%E3%80%82BugZilla%E4%BD%9C%E4%B8%BA%E8%80%81%E7%89%8C%E7%9A%84bug%E7%AE%A1%E7%90%86%E5%B7%A5%E5%85%B7%EF%BC%8C%E5%90%8C%E6%A0%B7%E6%9C" title="Ping.fm"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=TestLink%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5BugZilla%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95&uri=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Ftestlink-integrate-bugzilla-failed%2F" title="QQ书签"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=TestLink%E4%B8%8D%E8%83%BD%E8%BF%9E%E6%8E%A5BugZilla%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95%20-%20http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Ftestlink-integrate-bugzilla-failed%2F" title="Twitter"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>

<p>Related posts:<ol><li><a href='http://magustest.com/blog/uncategorized/stringbuffer-in-lua/' rel='bookmark' title='Permanent Link: 在Lua中实现简单的StringBuffer'>在Lua中实现简单的StringBuffer</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://magustest.com/blog/softwaretesting/testlink-integrate-bugzilla-failed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>年终总结，新年展望</title>
		<link>http://magustest.com/blog/daily/2010-new/</link>
		<comments>http://magustest.com/blog/daily/2010-new/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 15:58:09 +0000</pubDate>
		<dc:creator>magus</dc:creator>
				<category><![CDATA[个人日记]]></category>
		<category><![CDATA[职业发展]]></category>

		<guid isPermaLink="false">http://magustest.com/blog/?p=649</guid>
		<description><![CDATA[2009年，毕业后的第二年，上半年在MySpace，下半年在FreeWheel。测试技术上，有1年多的白盒测试经验，不过由于工作调动，现在已经没有做了，不过还好，还没有离开代码。在新的单位里面主要跟以下东西打交道，数据仓库，ETL工具，报表脚本，自动化回归测试框架，在线广告的业务逻辑。 在FreeWheel已经4个月了，工作开始上手，新的公司同事的素质都非常高，就我们Core来说吧，清华北大的占了一大半，第一次跟那么多非常聪明的人一起工作，有点兴奋，压力。公司发展的势头不错，我从进公司到现在，短短四个月，ad servering的流量应该翻了5倍吧。明年应该会增长的更加快，cool！ 明年工作上主要还是集中在数据库相关技术，自动化回归测试框架，Python应该是主要的编程语言。 keep learning&#8230; Share and Enjoy: No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>2009年，毕业后的第二年，上半年在MySpace，下半年在FreeWheel。测试技术上，有1年多的白盒测试经验，不过由于工作调动，现在已经没有做了，不过还好，还没有离开代码。在新的单位里面主要跟以下东西打交道，数据仓库，ETL工具，报表脚本，自动化回归测试框架，在线广告的业务逻辑。</p>
<p>在FreeWheel已经4个月了，工作开始上手，新的公司同事的素质都非常高，就我们Core来说吧，清华北大的占了一大半，第一次跟那么多非常聪明的人一起工作，有点兴奋，压力。公司发展的势头不错，我从进公司到现在，短短四个月，ad servering的流量应该翻了5倍吧。明年应该会增长的更加快，cool！</p>
<p>明年工作上主要还是集中在数据库相关技术，自动化回归测试框架，Python应该是主要的编程语言。</p>
<p>keep learning&#8230;</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://magustest.com/blog/feed/" title="RSS"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fmagustest.com%2Fblog%2Fdaily%2F2010-new%2F&amp;title=%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93%EF%BC%8C%E6%96%B0%E5%B9%B4%E5%B1%95%E6%9C%9B&amp;annotation=2009%E5%B9%B4%EF%BC%8C%E6%AF%95%E4%B8%9A%E5%90%8E%E7%9A%84%E7%AC%AC%E4%BA%8C%E5%B9%B4%EF%BC%8C%E4%B8%8A%E5%8D%8A%E5%B9%B4%E5%9C%A8MySpace%EF%BC%8C%E4%B8%8B%E5%8D%8A%E5%B9%B4%E5%9C%A8FreeWheel%E3%80%82%E6%B5%8B%E8%AF%95%E6%8A%80%E6%9C%AF%E4%B8%8A%EF%BC%8C%E6%9C%891%E5%B9%B4%E5%A4%9A%E7%9A%84%E7%99%BD%E7%9B%92%E6%B5%8B%E8%AF%95%E7%BB%8F%E9%AA%8C%EF%BC%8C%E4%B8%8D%E8%BF%87%E7%94%B1%E4%BA%8E%E5%B7%A5%E4%BD%9C%E8%B0%83%E5%8A%A8%EF%BC%8C%E7%8E%B0%E5%9C%A8%E5%B7%B2%E7%BB%8F%E6%B2%A1%E6%9C%89%E5%81%9A%E4%BA%86%EF%BC%8C%E4%B8%8D%E8%BF%87%E8%BF%98%E5%A5%BD%EF%BC%8C%E8%BF%98%E6%B2%A1%E6%9C%89%E7%A6%BB%E5%BC%80%E4%BB%A3%E7%A0%81%E3%80%82%E5%9C%A8%E6%96%B0%E7%9A%84%E5%8D%95%E4%BD%8D%E9%87%8C%E9%9D%A2%E4%B8%BB%E8" title="Google Bookmarks"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Fdaily%2F2010-new%2F&amp;title=%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93%EF%BC%8C%E6%96%B0%E5%B9%B4%E5%B1%95%E6%9C%9B&amp;bodytext=2009%E5%B9%B4%EF%BC%8C%E6%AF%95%E4%B8%9A%E5%90%8E%E7%9A%84%E7%AC%AC%E4%BA%8C%E5%B9%B4%EF%BC%8C%E4%B8%8A%E5%8D%8A%E5%B9%B4%E5%9C%A8MySpace%EF%BC%8C%E4%B8%8B%E5%8D%8A%E5%B9%B4%E5%9C%A8FreeWheel%E3%80%82%E6%B5%8B%E8%AF%95%E6%8A%80%E6%9C%AF%E4%B8%8A%EF%BC%8C%E6%9C%891%E5%B9%B4%E5%A4%9A%E7%9A%84%E7%99%BD%E7%9B%92%E6%B5%8B%E8%AF%95%E7%BB%8F%E9%AA%8C%EF%BC%8C%E4%B8%8D%E8%BF%87%E7%94%B1%E4%BA%8E%E5%B7%A5%E4%BD%9C%E8%B0%83%E5%8A%A8%EF%BC%8C%E7%8E%B0%E5%9C%A8%E5%B7%B2%E7%BB%8F%E6%B2%A1%E6%9C%89%E5%81%9A%E4%BA%86%EF%BC%8C%E4%B8%8D%E8%BF%87%E8%BF%98%E5%A5%BD%EF%BC%8C%E8%BF%98%E6%B2%A1%E6%9C%89%E7%A6%BB%E5%BC%80%E4%BB%A3%E7%A0%81%E3%80%82%E5%9C%A8%E6%96%B0%E7%9A%84%E5%8D%95%E4%BD%8D%E9%87%8C%E9%9D%A2%E4%B8%BB%E8" title="Digg"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fdaily%2F2010-new%2F&amp;title=%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93%EF%BC%8C%E6%96%B0%E5%B9%B4%E5%B1%95%E6%9C%9B&amp;notes=2009%E5%B9%B4%EF%BC%8C%E6%AF%95%E4%B8%9A%E5%90%8E%E7%9A%84%E7%AC%AC%E4%BA%8C%E5%B9%B4%EF%BC%8C%E4%B8%8A%E5%8D%8A%E5%B9%B4%E5%9C%A8MySpace%EF%BC%8C%E4%B8%8B%E5%8D%8A%E5%B9%B4%E5%9C%A8FreeWheel%E3%80%82%E6%B5%8B%E8%AF%95%E6%8A%80%E6%9C%AF%E4%B8%8A%EF%BC%8C%E6%9C%891%E5%B9%B4%E5%A4%9A%E7%9A%84%E7%99%BD%E7%9B%92%E6%B5%8B%E8%AF%95%E7%BB%8F%E9%AA%8C%EF%BC%8C%E4%B8%8D%E8%BF%87%E7%94%B1%E4%BA%8E%E5%B7%A5%E4%BD%9C%E8%B0%83%E5%8A%A8%EF%BC%8C%E7%8E%B0%E5%9C%A8%E5%B7%B2%E7%BB%8F%E6%B2%A1%E6%9C%89%E5%81%9A%E4%BA%86%EF%BC%8C%E4%B8%8D%E8%BF%87%E8%BF%98%E5%A5%BD%EF%BC%8C%E8%BF%98%E6%B2%A1%E6%9C%89%E7%A6%BB%E5%BC%80%E4%BB%A3%E7%A0%81%E3%80%82%E5%9C%A8%E6%96%B0%E7%9A%84%E5%8D%95%E4%BD%8D%E9%87%8C%E9%9D%A2%E4%B8%BB%E8" title="del.icio.us"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fmagustest.com%2Fblog%2Fdaily%2F2010-new%2F&amp;t=%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93%EF%BC%8C%E6%96%B0%E5%B9%B4%E5%B1%95%E6%9C%9B" title="Facebook"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fdaily%2F2010-new%2F&title=%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93%EF%BC%8C%E6%96%B0%E5%B9%B4%E5%B1%95%E6%9C%9B" title="豆瓣"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban.png" title="豆瓣" alt="豆瓣" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fdaily%2F2010-new%2F&title=%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93%EF%BC%8C%E6%96%B0%E5%B9%B4%E5%B1%95%E6%9C%9B&n=1" title="豆瓣九点"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban9.png" title="豆瓣九点" alt="豆瓣九点" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.friendfeed.com/share?title=%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93%EF%BC%8C%E6%96%B0%E5%B9%B4%E5%B1%95%E6%9C%9B&amp;link=http%3A%2F%2Fmagustest.com%2Fblog%2Fdaily%2F2010-new%2F" title="FriendFeed"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Fdaily%2F2010-new%2F&amp;title=%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93%EF%BC%8C%E6%96%B0%E5%B9%B4%E5%B1%95%E6%9C%9B" title="Live"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fmagustest.com%2Fblog%2Fdaily%2F2010-new%2F&amp;title=%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93%EF%BC%8C%E6%96%B0%E5%B9%B4%E5%B1%95%E6%9C%9B&amp;body=2009%E5%B9%B4%EF%BC%8C%E6%AF%95%E4%B8%9A%E5%90%8E%E7%9A%84%E7%AC%AC%E4%BA%8C%E5%B9%B4%EF%BC%8C%E4%B8%8A%E5%8D%8A%E5%B9%B4%E5%9C%A8MySpace%EF%BC%8C%E4%B8%8B%E5%8D%8A%E5%B9%B4%E5%9C%A8FreeWheel%E3%80%82%E6%B5%8B%E8%AF%95%E6%8A%80%E6%9C%AF%E4%B8%8A%EF%BC%8C%E6%9C%891%E5%B9%B4%E5%A4%9A%E7%9A%84%E7%99%BD%E7%9B%92%E6%B5%8B%E8%AF%95%E7%BB%8F%E9%AA%8C%EF%BC%8C%E4%B8%8D%E8%BF%87%E7%94%B1%E4%BA%8E%E5%B7%A5%E4%BD%9C%E8%B0%83%E5%8A%A8%EF%BC%8C%E7%8E%B0%E5%9C%A8%E5%B7%B2%E7%BB%8F%E6%B2%A1%E6%9C%89%E5%81%9A%E4%BA%86%EF%BC%8C%E4%B8%8D%E8%BF%87%E8%BF%98%E5%A5%BD%EF%BC%8C%E8%BF%98%E6%B2%A1%E6%9C%89%E7%A6%BB%E5%BC%80%E4%BB%A3%E7%A0%81%E3%80%82%E5%9C%A8%E6%96%B0%E7%9A%84%E5%8D%95%E4%BD%8D%E9%87%8C%E9%9D%A2%E4%B8%BB%E8" title="Ping.fm"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93%EF%BC%8C%E6%96%B0%E5%B9%B4%E5%B1%95%E6%9C%9B&uri=http%3A%2F%2Fmagustest.com%2Fblog%2Fdaily%2F2010-new%2F" title="QQ书签"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=%E5%B9%B4%E7%BB%88%E6%80%BB%E7%BB%93%EF%BC%8C%E6%96%B0%E5%B9%B4%E5%B1%95%E6%9C%9B%20-%20http%3A%2F%2Fmagustest.com%2Fblog%2Fdaily%2F2010-new%2F" title="Twitter"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://magustest.com/blog/daily/2010-new/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>自动化测试中的sleep</title>
		<link>http://magustest.com/blog/automationtesting/sleep-in-test-automation/</link>
		<comments>http://magustest.com/blog/automationtesting/sleep-in-test-automation/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 13:44:40 +0000</pubDate>
		<dc:creator>magus</dc:creator>
				<category><![CDATA[自动化测试]]></category>

		<guid isPermaLink="false">http://magustest.com/blog/?p=647</guid>
		<description><![CDATA[最近在修改公司现有的一个自动化测试框架，里面用了很多time.sleep()方法，看着不是很爽，为什么我觉得sleep方法在自动化测试中不应该过多的使用呢，我甚至觉得应该尽可能避免sleep方法的使用，sleep可以作为增加自动化测试稳定性的手段，但是不能依赖sleep来让自动化系统稳定。 举个例子，如果一个UI的自动化测试，需要等待某个页面load完成以后才进行操作，那么需要对那个页面是否已经Load完成进行判断，而不应该sleep(x)，x是一个magic number，有时候1、2秒就足以，有时候它却不知道有多大，因为已经超时了！那如果我们在check页面状态之前做一个短时间的sleep，那么在某些场合下可以增加这个自动化测试的稳定性，但是最终整个自动化测试的脚本是不会依赖于这个sleep的语句来达到稳定的。 在做自动化测试的时候，最常见的两种判断就是1. 某程序已经成功启动，某页面已经加载完毕。 2. 某程序已经正常关闭，某服务已经顺利停止。 回到实际的工作，我要判断被测的程序是否已经正常启动，可以用系统提供的一些工具，或者调用一些接口，例如SNMP命令，或者是调用一下Lua脚本等，如果他们都返回我们期望的数据，那么可以认为程序已经成功启动了。反之，如果前面的这些命令出错了，那么我也可以认为程序已经是关闭了的。 要实现自动化测试，就必须要让测试代码每时每刻都掌握着被测系统的状态，sleep方法会让自动化测试脚本的行为变得诡异。 Share and Enjoy: No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>最近在修改公司现有的一个自动化测试框架，里面用了很多time.sleep()方法，看着不是很爽，为什么我觉得sleep方法在自动化测试中不应该过多的使用呢，我甚至觉得应该尽可能避免sleep方法的使用，sleep可以作为增加自动化测试稳定性的手段，但是不能依赖sleep来让自动化系统稳定。</p>
<p>举个例子，如果一个UI的自动化测试，需要等待某个页面load完成以后才进行操作，那么需要对那个页面是否已经Load完成进行判断，而不应该sleep(x)，x是一个magic number，有时候1、2秒就足以，有时候它却不知道有多大，因为已经超时了！那如果我们在check页面状态之前做一个短时间的sleep，那么在某些场合下可以增加这个自动化测试的稳定性，但是最终整个自动化测试的脚本是不会依赖于这个sleep的语句来达到稳定的。</p>
<p>在做自动化测试的时候，最常见的两种判断就是1. 某程序已经成功启动，某页面已经加载完毕。 2. 某程序已经正常关闭，某服务已经顺利停止。</p>
<p>回到实际的工作，我要判断被测的程序是否已经正常启动，可以用系统提供的一些工具，或者调用一些接口，例如SNMP命令，或者是调用一下Lua脚本等，如果他们都返回我们期望的数据，那么可以认为程序已经成功启动了。反之，如果前面的这些命令出错了，那么我也可以认为程序已经是关闭了的。</p>
<p>要实现自动化测试，就必须要让测试代码每时每刻都掌握着被测系统的状态，sleep方法会让<a href="http://magustest.com/blog/automationtesting/avoid-flakey-automation-test/" target="_blank">自动化测试脚本的行为变得诡异</a>。</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://magustest.com/blog/feed/" title="RSS"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fsleep-in-test-automation%2F&amp;title=%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E7%9A%84sleep&amp;annotation=%E6%9C%80%E8%BF%91%E5%9C%A8%E4%BF%AE%E6%94%B9%E5%85%AC%E5%8F%B8%E7%8E%B0%E6%9C%89%E7%9A%84%E4%B8%80%E4%B8%AA%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E6%A1%86%E6%9E%B6%EF%BC%8C%E9%87%8C%E9%9D%A2%E7%94%A8%E4%BA%86%E5%BE%88%E5%A4%9Atime.sleep%28%29%E6%96%B9%E6%B3%95%EF%BC%8C%E7%9C%8B%E7%9D%80%E4%B8%8D%E6%98%AF%E5%BE%88%E7%88%BD%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E8%A7%89%E5%BE%97sleep%E6%96%B9%E6%B3%95%E5%9C%A8%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E4%B8%8D%E5%BA%94%E8%AF%A5%E8%BF%87%E5%A4%9A%E7%9A%84%E4%BD%BF%E7%94%A8%E5%91%A2%EF%BC%8C%E6%88%91%E7%94%9A%E8%87%B3%E8%A7%89%E5%BE%97%E5%BA%94%E8%AF%A5%E5%B0%BD%E5%8F%AF%E8%83%BD%E9%81%BF%E5%85%8Dsleep%E6%96%B9%E6%B3%95%E7%9A%84" title="Google Bookmarks"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fsleep-in-test-automation%2F&amp;title=%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E7%9A%84sleep&amp;bodytext=%E6%9C%80%E8%BF%91%E5%9C%A8%E4%BF%AE%E6%94%B9%E5%85%AC%E5%8F%B8%E7%8E%B0%E6%9C%89%E7%9A%84%E4%B8%80%E4%B8%AA%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E6%A1%86%E6%9E%B6%EF%BC%8C%E9%87%8C%E9%9D%A2%E7%94%A8%E4%BA%86%E5%BE%88%E5%A4%9Atime.sleep%28%29%E6%96%B9%E6%B3%95%EF%BC%8C%E7%9C%8B%E7%9D%80%E4%B8%8D%E6%98%AF%E5%BE%88%E7%88%BD%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E8%A7%89%E5%BE%97sleep%E6%96%B9%E6%B3%95%E5%9C%A8%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E4%B8%8D%E5%BA%94%E8%AF%A5%E8%BF%87%E5%A4%9A%E7%9A%84%E4%BD%BF%E7%94%A8%E5%91%A2%EF%BC%8C%E6%88%91%E7%94%9A%E8%87%B3%E8%A7%89%E5%BE%97%E5%BA%94%E8%AF%A5%E5%B0%BD%E5%8F%AF%E8%83%BD%E9%81%BF%E5%85%8Dsleep%E6%96%B9%E6%B3%95%E7%9A%84" title="Digg"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fsleep-in-test-automation%2F&amp;title=%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E7%9A%84sleep&amp;notes=%E6%9C%80%E8%BF%91%E5%9C%A8%E4%BF%AE%E6%94%B9%E5%85%AC%E5%8F%B8%E7%8E%B0%E6%9C%89%E7%9A%84%E4%B8%80%E4%B8%AA%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E6%A1%86%E6%9E%B6%EF%BC%8C%E9%87%8C%E9%9D%A2%E7%94%A8%E4%BA%86%E5%BE%88%E5%A4%9Atime.sleep%28%29%E6%96%B9%E6%B3%95%EF%BC%8C%E7%9C%8B%E7%9D%80%E4%B8%8D%E6%98%AF%E5%BE%88%E7%88%BD%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E8%A7%89%E5%BE%97sleep%E6%96%B9%E6%B3%95%E5%9C%A8%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E4%B8%8D%E5%BA%94%E8%AF%A5%E8%BF%87%E5%A4%9A%E7%9A%84%E4%BD%BF%E7%94%A8%E5%91%A2%EF%BC%8C%E6%88%91%E7%94%9A%E8%87%B3%E8%A7%89%E5%BE%97%E5%BA%94%E8%AF%A5%E5%B0%BD%E5%8F%AF%E8%83%BD%E9%81%BF%E5%85%8Dsleep%E6%96%B9%E6%B3%95%E7%9A%84" title="del.icio.us"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fsleep-in-test-automation%2F&amp;t=%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E7%9A%84sleep" title="Facebook"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fsleep-in-test-automation%2F&title=%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E7%9A%84sleep" title="豆瓣"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban.png" title="豆瓣" alt="豆瓣" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fsleep-in-test-automation%2F&title=%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E7%9A%84sleep&n=1" title="豆瓣九点"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban9.png" title="豆瓣九点" alt="豆瓣九点" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.friendfeed.com/share?title=%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E7%9A%84sleep&amp;link=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fsleep-in-test-automation%2F" title="FriendFeed"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fsleep-in-test-automation%2F&amp;title=%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E7%9A%84sleep" title="Live"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fsleep-in-test-automation%2F&amp;title=%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E7%9A%84sleep&amp;body=%E6%9C%80%E8%BF%91%E5%9C%A8%E4%BF%AE%E6%94%B9%E5%85%AC%E5%8F%B8%E7%8E%B0%E6%9C%89%E7%9A%84%E4%B8%80%E4%B8%AA%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E6%A1%86%E6%9E%B6%EF%BC%8C%E9%87%8C%E9%9D%A2%E7%94%A8%E4%BA%86%E5%BE%88%E5%A4%9Atime.sleep%28%29%E6%96%B9%E6%B3%95%EF%BC%8C%E7%9C%8B%E7%9D%80%E4%B8%8D%E6%98%AF%E5%BE%88%E7%88%BD%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E8%A7%89%E5%BE%97sleep%E6%96%B9%E6%B3%95%E5%9C%A8%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E4%B8%8D%E5%BA%94%E8%AF%A5%E8%BF%87%E5%A4%9A%E7%9A%84%E4%BD%BF%E7%94%A8%E5%91%A2%EF%BC%8C%E6%88%91%E7%94%9A%E8%87%B3%E8%A7%89%E5%BE%97%E5%BA%94%E8%AF%A5%E5%B0%BD%E5%8F%AF%E8%83%BD%E9%81%BF%E5%85%8Dsleep%E6%96%B9%E6%B3%95%E7%9A%84" title="Ping.fm"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E7%9A%84sleep&uri=http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fsleep-in-test-automation%2F" title="QQ书签"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E4%B8%AD%E7%9A%84sleep%20-%20http%3A%2F%2Fmagustest.com%2Fblog%2Fautomationtesting%2Fsleep-in-test-automation%2F" title="Twitter"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://magustest.com/blog/automationtesting/sleep-in-test-automation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>谁来保证测试工作的质量</title>
		<link>http://magustest.com/blog/softwaretesting/who-watches-the-watchers/</link>
		<comments>http://magustest.com/blog/softwaretesting/who-watches-the-watchers/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 14:25:15 +0000</pubDate>
		<dc:creator>magus</dc:creator>
				<category><![CDATA[软件测试]]></category>

		<guid isPermaLink="false">http://magustest.com/blog/?p=644</guid>
		<description><![CDATA[在一个公司或者是某个组织里面，测试人员扮演的角色通常都会被认为是软件质量的保证者，把关者，仿佛经过测试的产品都是没有任何缺陷的。但事实大家都知道，即使经过多么“完美”测试的产品，总免不了在发布以后还会发现或多或少的问题。 以前在MySpace做测试的时候，主要是写代码来测试一些接口、模块等。这样就会出现一个问题，我用一段程序A去测试层序B，那么测试代码也是程序，如何保证程序A的正确性呢？OK，我们可以写一个程序C去测试程序A，由此来保障程序A的正确性，但是程序C的正确性又由谁来保证呢？who watches the watchers？当时只有我一个人负责白盒测试，最多也就是让开发帮忙看看。其实对于一段程序，只要写的足够简单，那么就可以认为这段简单的程序的正确性是能得到保证的。所以我一直都给自己强调，单元测试的代码不要写的复杂，尽可能不用判断，让测试代码顺序执行下去。 但是对于功能测试来说，怎么样才能尽可能地保证测试的方法，测试的数据，测试的覆盖率是能达到某项标准的呢？在这次MRM 2.9 Release的测试过程中，我们引入了peer review的做法，一个功能点一般会以ticket的形式存在，每个人拿到ticket的时候首先自己设计测试用例，包括测试数据的准备，用什么样的方法等等。然后找另外一个同事来review自己的用例。这样做的好处有： 强迫自己有一个较为系统的测试用例设计，因为这个是需要给同事看，并且让别人看懂的 同事之间的knowledge share在不知不觉中就达到 两个人的review总是比一大群人坐到会议室里面要有效，帮助提高测试覆盖率，尽可能避免测试盲点 互相监督 Share and Enjoy: No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>在一个公司或者是某个组织里面，测试人员扮演的角色通常都会被认为是软件质量的保证者，把关者，仿佛经过测试的产品都是没有任何缺陷的。但事实大家都知道，即使经过多么“完美”测试的产品，总免不了在发布以后还会发现或多或少的问题。</p>
<p>以前在MySpace做测试的时候，主要是写代码来测试一些接口、模块等。这样就会出现一个问题，我用一段程序A去测试层序B，那么测试代码也是程序，如何保证程序A的正确性呢？OK，我们可以写一个程序C去测试程序A，由此来保障程序A的正确性，但是程序C的正确性又由谁来保证呢？who watches the watchers？当时只有我一个人负责白盒测试，最多也就是让开发帮忙看看。其实对于一段程序，只要写的足够简单，那么就可以认为这段简单的程序的正确性是能得到保证的。所以我一直都给自己强调，单元测试的代码不要写的复杂，尽可能不用判断，让测试代码顺序执行下去。</p>
<p>但是对于功能测试来说，怎么样才能尽可能地保证测试的方法，测试的数据，测试的覆盖率是能达到某项标准的呢？在这次MRM 2.9 Release的测试过程中，我们引入了peer review的做法，一个功能点一般会以ticket的形式存在，每个人拿到ticket的时候首先自己设计测试用例，包括测试数据的准备，用什么样的方法等等。然后找另外一个同事来review自己的用例。这样做的好处有：</p>
<ol>
<li>强迫自己有一个较为系统的测试用例设计，因为这个是需要给同事看，并且让别人看懂的</li>
<li>同事之间的knowledge share在不知不觉中就达到</li>
<li>两个人的review总是比一大群人坐到会议室里面要有效，帮助提高测试覆盖率，尽可能避免测试盲点</li>
<li>互相监督</li>
</ol>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://magustest.com/blog/feed/" title="RSS"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Fwho-watches-the-watchers%2F&amp;t=%E8%B0%81%E6%9D%A5%E4%BF%9D%E8%AF%81%E6%B5%8B%E8%AF%95%E5%B7%A5%E4%BD%9C%E7%9A%84%E8%B4%A8%E9%87%8F" title="Facebook"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Fwho-watches-the-watchers%2F&title=%E8%B0%81%E6%9D%A5%E4%BF%9D%E8%AF%81%E6%B5%8B%E8%AF%95%E5%B7%A5%E4%BD%9C%E7%9A%84%E8%B4%A8%E9%87%8F" title="豆瓣"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban.png" title="豆瓣" alt="豆瓣" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Fwho-watches-the-watchers%2F&title=%E8%B0%81%E6%9D%A5%E4%BF%9D%E8%AF%81%E6%B5%8B%E8%AF%95%E5%B7%A5%E4%BD%9C%E7%9A%84%E8%B4%A8%E9%87%8F&n=1" title="豆瓣九点"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban9.png" title="豆瓣九点" alt="豆瓣九点" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.friendfeed.com/share?title=%E8%B0%81%E6%9D%A5%E4%BF%9D%E8%AF%81%E6%B5%8B%E8%AF%95%E5%B7%A5%E4%BD%9C%E7%9A%84%E8%B4%A8%E9%87%8F&amp;link=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Fwho-watches-the-watchers%2F" title="FriendFeed"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Fwho-watches-the-watchers%2F&amp;title=%E8%B0%81%E6%9D%A5%E4%BF%9D%E8%AF%81%E6%B5%8B%E8%AF%95%E5%B7%A5%E4%BD%9C%E7%9A%84%E8%B4%A8%E9%87%8F" title="Live"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=%E8%B0%81%E6%9D%A5%E4%BF%9D%E8%AF%81%E6%B5%8B%E8%AF%95%E5%B7%A5%E4%BD%9C%E7%9A%84%E8%B4%A8%E9%87%8F&uri=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Fwho-watches-the-watchers%2F" title="QQ书签"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=%E8%B0%81%E6%9D%A5%E4%BF%9D%E8%AF%81%E6%B5%8B%E8%AF%95%E5%B7%A5%E4%BD%9C%E7%9A%84%E8%B4%A8%E9%87%8F%20-%20http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Fwho-watches-the-watchers%2F" title="Twitter"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://magustest.com/blog/softwaretesting/who-watches-the-watchers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python多行注释技巧</title>
		<link>http://magustest.com/blog/uncategorized/python-comment-multiline/</link>
		<comments>http://magustest.com/blog/uncategorized/python-comment-multiline/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 09:47:13 +0000</pubDate>
		<dc:creator>magus</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://magustest.com/blog/?p=642</guid>
		<description><![CDATA[Python语言本身是没有注释多行的支持的，如果需要注册多行，可以用一个取巧的方法，就是把需要注释的代码块用三个括号括起来，赋值为一个永远都不会使用的字符串变量，例如： 1 2 3 4 5 6 7 8 9 10 11 12 13 __devilcomment = ''' if bCmpLog == &#34;True&#34;: self.appendAdsLogToCmpLog(&#34;&#34;) &#160; if bCmpBinaryLog == &#34;True&#34;: self.appendBinaryAdsLogToCmpLog(res) &#160; if bCompareResp == &#34;True&#34;: self.appendResponseToCmpLog(response_strs) &#160; print &#34;move new and debug logs&#34; self.tools.move (src_db,dst_db) ''' Share and Enjoy: Related posts:用PDB库调试Python程序 《Software Testing》第十五章 &#8211; 自动化测试和测试工具


Related posts:<ol><li><a href='http://magustest.com/blog/computer/use-pdb-debug-python/' rel='bookmark' title='Permanent Link: 用PDB库调试Python程序'>用PDB库调试Python程序</a></li>
<li><a href='http://magustest.com/blog/readingdaily/software-testing-note-part-fifteen/' rel='bookmark' title='Permanent Link: 《Software Testing》第十五章 &#8211; 自动化测试和测试工具'>《Software Testing》第十五章 &#8211; 自动化测试和测试工具</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Python语言本身是没有注释多行的支持的，如果需要注册多行，可以用一个取巧的方法，就是把需要注释的代码块用三个括号括起来，赋值为一个永远都不会使用的字符串变量，例如：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">__devilcomment = <span style="color: #483d8b;">''</span><span style="color: #483d8b;">'
if bCmpLog == &quot;True&quot;:
        self.appendAdsLogToCmpLog(&quot;&quot;)
&nbsp;
if bCmpBinaryLog == &quot;True&quot;:
        self.appendBinaryAdsLogToCmpLog(res)
&nbsp;
if bCompareResp == &quot;True&quot;:
    self.appendResponseToCmpLog(response_strs)
&nbsp;
print &quot;move new and debug logs&quot;
self.tools.move (src_db,dst_db)
'</span><span style="color: #483d8b;">''</span></pre></td></tr></table></div>




Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://magustest.com/blog/feed/" title="RSS"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fpython-comment-multiline%2F&amp;title=Python%E5%A4%9A%E8%A1%8C%E6%B3%A8%E9%87%8A%E6%8A%80%E5%B7%A7&amp;annotation=Python%E8%AF%AD%E8%A8%80%E6%9C%AC%E8%BA%AB%E6%98%AF%E6%B2%A1%E6%9C%89%E6%B3%A8%E9%87%8A%E5%A4%9A%E8%A1%8C%E7%9A%84%E6%94%AF%E6%8C%81%E7%9A%84%EF%BC%8C%E5%A6%82%E6%9E%9C%E9%9C%80%E8%A6%81%E6%B3%A8%E5%86%8C%E5%A4%9A%E8%A1%8C%EF%BC%8C%E5%8F%AF%E4%BB%A5%E7%94%A8%E4%B8%80%E4%B8%AA%E5%8F%96%E5%B7%A7%E7%9A%84%E6%96%B9%E6%B3%95%EF%BC%8C%E5%B0%B1%E6%98%AF%E6%8A%8A%E9%9C%80%E8%A6%81%E6%B3%A8%E9%87%8A%E7%9A%84%E4%BB%A3%E7%A0%81%E5%9D%97%E7%94%A8%E4%B8%89%E4%B8%AA%E6%8B%AC%E5%8F%B7%E6%8B%AC%E8%B5%B7%E6%9D%A5%EF%BC%8C%E8%B5%8B%E5%80%BC%E4%B8%BA%E4%B8%80%E4%B8%AA%E6%B0%B8%E8%BF%9C%E9%83%BD%E4%B8%8D%E4%BC%9A%E4%BD%BF%E7%94%A8%E7%9A%84%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%8F%98%E9%87%8F%EF%BC%8C%E4%BE%8B%E5%A6%82%EF%BC%9A%0D%0A%0D%0A__devi" title="Google Bookmarks"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fpython-comment-multiline%2F&amp;title=Python%E5%A4%9A%E8%A1%8C%E6%B3%A8%E9%87%8A%E6%8A%80%E5%B7%A7&amp;bodytext=Python%E8%AF%AD%E8%A8%80%E6%9C%AC%E8%BA%AB%E6%98%AF%E6%B2%A1%E6%9C%89%E6%B3%A8%E9%87%8A%E5%A4%9A%E8%A1%8C%E7%9A%84%E6%94%AF%E6%8C%81%E7%9A%84%EF%BC%8C%E5%A6%82%E6%9E%9C%E9%9C%80%E8%A6%81%E6%B3%A8%E5%86%8C%E5%A4%9A%E8%A1%8C%EF%BC%8C%E5%8F%AF%E4%BB%A5%E7%94%A8%E4%B8%80%E4%B8%AA%E5%8F%96%E5%B7%A7%E7%9A%84%E6%96%B9%E6%B3%95%EF%BC%8C%E5%B0%B1%E6%98%AF%E6%8A%8A%E9%9C%80%E8%A6%81%E6%B3%A8%E9%87%8A%E7%9A%84%E4%BB%A3%E7%A0%81%E5%9D%97%E7%94%A8%E4%B8%89%E4%B8%AA%E6%8B%AC%E5%8F%B7%E6%8B%AC%E8%B5%B7%E6%9D%A5%EF%BC%8C%E8%B5%8B%E5%80%BC%E4%B8%BA%E4%B8%80%E4%B8%AA%E6%B0%B8%E8%BF%9C%E9%83%BD%E4%B8%8D%E4%BC%9A%E4%BD%BF%E7%94%A8%E7%9A%84%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%8F%98%E9%87%8F%EF%BC%8C%E4%BE%8B%E5%A6%82%EF%BC%9A%0D%0A%0D%0A__devi" title="Digg"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fpython-comment-multiline%2F&amp;title=Python%E5%A4%9A%E8%A1%8C%E6%B3%A8%E9%87%8A%E6%8A%80%E5%B7%A7&amp;notes=Python%E8%AF%AD%E8%A8%80%E6%9C%AC%E8%BA%AB%E6%98%AF%E6%B2%A1%E6%9C%89%E6%B3%A8%E9%87%8A%E5%A4%9A%E8%A1%8C%E7%9A%84%E6%94%AF%E6%8C%81%E7%9A%84%EF%BC%8C%E5%A6%82%E6%9E%9C%E9%9C%80%E8%A6%81%E6%B3%A8%E5%86%8C%E5%A4%9A%E8%A1%8C%EF%BC%8C%E5%8F%AF%E4%BB%A5%E7%94%A8%E4%B8%80%E4%B8%AA%E5%8F%96%E5%B7%A7%E7%9A%84%E6%96%B9%E6%B3%95%EF%BC%8C%E5%B0%B1%E6%98%AF%E6%8A%8A%E9%9C%80%E8%A6%81%E6%B3%A8%E9%87%8A%E7%9A%84%E4%BB%A3%E7%A0%81%E5%9D%97%E7%94%A8%E4%B8%89%E4%B8%AA%E6%8B%AC%E5%8F%B7%E6%8B%AC%E8%B5%B7%E6%9D%A5%EF%BC%8C%E8%B5%8B%E5%80%BC%E4%B8%BA%E4%B8%80%E4%B8%AA%E6%B0%B8%E8%BF%9C%E9%83%BD%E4%B8%8D%E4%BC%9A%E4%BD%BF%E7%94%A8%E7%9A%84%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%8F%98%E9%87%8F%EF%BC%8C%E4%BE%8B%E5%A6%82%EF%BC%9A%0D%0A%0D%0A__devi" title="del.icio.us"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fpython-comment-multiline%2F&amp;t=Python%E5%A4%9A%E8%A1%8C%E6%B3%A8%E9%87%8A%E6%8A%80%E5%B7%A7" title="Facebook"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fpython-comment-multiline%2F&title=Python%E5%A4%9A%E8%A1%8C%E6%B3%A8%E9%87%8A%E6%8A%80%E5%B7%A7" title="豆瓣"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban.png" title="豆瓣" alt="豆瓣" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fpython-comment-multiline%2F&title=Python%E5%A4%9A%E8%A1%8C%E6%B3%A8%E9%87%8A%E6%8A%80%E5%B7%A7&n=1" title="豆瓣九点"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban9.png" title="豆瓣九点" alt="豆瓣九点" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.friendfeed.com/share?title=Python%E5%A4%9A%E8%A1%8C%E6%B3%A8%E9%87%8A%E6%8A%80%E5%B7%A7&amp;link=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fpython-comment-multiline%2F" title="FriendFeed"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fpython-comment-multiline%2F&amp;title=Python%E5%A4%9A%E8%A1%8C%E6%B3%A8%E9%87%8A%E6%8A%80%E5%B7%A7" title="Live"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fpython-comment-multiline%2F&amp;title=Python%E5%A4%9A%E8%A1%8C%E6%B3%A8%E9%87%8A%E6%8A%80%E5%B7%A7&amp;body=Python%E8%AF%AD%E8%A8%80%E6%9C%AC%E8%BA%AB%E6%98%AF%E6%B2%A1%E6%9C%89%E6%B3%A8%E9%87%8A%E5%A4%9A%E8%A1%8C%E7%9A%84%E6%94%AF%E6%8C%81%E7%9A%84%EF%BC%8C%E5%A6%82%E6%9E%9C%E9%9C%80%E8%A6%81%E6%B3%A8%E5%86%8C%E5%A4%9A%E8%A1%8C%EF%BC%8C%E5%8F%AF%E4%BB%A5%E7%94%A8%E4%B8%80%E4%B8%AA%E5%8F%96%E5%B7%A7%E7%9A%84%E6%96%B9%E6%B3%95%EF%BC%8C%E5%B0%B1%E6%98%AF%E6%8A%8A%E9%9C%80%E8%A6%81%E6%B3%A8%E9%87%8A%E7%9A%84%E4%BB%A3%E7%A0%81%E5%9D%97%E7%94%A8%E4%B8%89%E4%B8%AA%E6%8B%AC%E5%8F%B7%E6%8B%AC%E8%B5%B7%E6%9D%A5%EF%BC%8C%E8%B5%8B%E5%80%BC%E4%B8%BA%E4%B8%80%E4%B8%AA%E6%B0%B8%E8%BF%9C%E9%83%BD%E4%B8%8D%E4%BC%9A%E4%BD%BF%E7%94%A8%E7%9A%84%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%8F%98%E9%87%8F%EF%BC%8C%E4%BE%8B%E5%A6%82%EF%BC%9A%0D%0A%0D%0A__devi" title="Ping.fm"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=Python%E5%A4%9A%E8%A1%8C%E6%B3%A8%E9%87%8A%E6%8A%80%E5%B7%A7&uri=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fpython-comment-multiline%2F" title="QQ书签"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Python%E5%A4%9A%E8%A1%8C%E6%B3%A8%E9%87%8A%E6%8A%80%E5%B7%A7%20-%20http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fpython-comment-multiline%2F" title="Twitter"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>

<p>Related posts:<ol><li><a href='http://magustest.com/blog/computer/use-pdb-debug-python/' rel='bookmark' title='Permanent Link: 用PDB库调试Python程序'>用PDB库调试Python程序</a></li>
<li><a href='http://magustest.com/blog/readingdaily/software-testing-note-part-fifteen/' rel='bookmark' title='Permanent Link: 《Software Testing》第十五章 &#8211; 自动化测试和测试工具'>《Software Testing》第十五章 &#8211; 自动化测试和测试工具</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://magustest.com/blog/uncategorized/python-comment-multiline/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>用PDB库调试Python程序</title>
		<link>http://magustest.com/blog/computer/use-pdb-debug-python/</link>
		<comments>http://magustest.com/blog/computer/use-pdb-debug-python/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 13:17:49 +0000</pubDate>
		<dc:creator>magus</dc:creator>
				<category><![CDATA[计算机技术]]></category>

		<guid isPermaLink="false">http://magustest.com/blog/?p=640</guid>
		<description><![CDATA[如果使用过微软技术的朋友应该体会过微软的Visual Studio系列IDE给debug程序带来的方便，换了个工作就没有Visual Studio了，对于我这种从未在非GUI环境下调试过程序的人来说实在有点不爽，今天花了点时间看了一下Python自带的pdb库，发现用pdb来调试程序还是很方便的，当然了，什么远程调试，多线程之类，pdb是搞不定的。 用pdb调试有多种方式可选： 1. 命令行启动目标程序，加上-m参数，这样调用myscript.py的话断点就是程序的执行第一行之前 python -m pdb myscript.py 2. 在Python交互环境中启用调试 &#62;&#62;&#62; import pdb &#62;&#62;&#62; import mymodule &#62;&#62;&#62; pdb.run(&#8216;mymodule.test()&#8217;) 3. 比较常用的，就是在程序中间插入一段程序，相对于在一般IDE里面打上断点然后启动debug，不过这种方式是hardcode的 if __name__ == &#34;__main__&#34;: a = 1 import pdb pdb.set_trace&#40;&#41; b = 2 c = a + b print &#40;c&#41; 然后正常运行脚本，到了pdb.set_trace()那就会定下来，就可以看到调试的提示符(Pdb)了 常用的调试命令 h(elp)，会打印当前版本Pdb可用的命令，如果要查询某个命令，可以输入 h [command]，例如：“h l” &#8212; 查看list命令 l(ist)，可以列出当前将要运行的代码块 (Pdb) l 497 pdb.set_trace() [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>如果使用过微软技术的朋友应该体会过微软的Visual Studio系列IDE给debug程序带来的方便，换了个工作就没有Visual Studio了，对于我这种从未在非GUI环境下调试过程序的人来说实在有点不爽，今天花了点时间看了一下Python自带的pdb库，发现用pdb来调试程序还是很方便的，当然了，什么远程调试，多线程之类，pdb是搞不定的。</p>
<p>用pdb调试有多种方式可选：</p>
<p>1. 命令行启动目标程序，加上-m参数，这样调用myscript.py的话断点就是程序的执行第一行之前<br />
python -m pdb myscript.py</p>
<p>2. 在Python交互环境中启用调试<br />
&gt;&gt;&gt; import pdb<br />
&gt;&gt;&gt; import mymodule<br />
&gt;&gt;&gt; pdb.run(&#8216;mymodule.test()&#8217;)</p>
<p>3. 比较常用的，就是在程序中间插入一段程序，相对于在一般IDE里面打上断点然后启动debug，不过这种方式是hardcode的</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
    a = <span style="color: #ff4500;">1</span>
    <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">pdb</span>
    <span style="color: #dc143c;">pdb</span>.<span style="color: black;">set_trace</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    b = <span style="color: #ff4500;">2</span>
    c = a + b
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: black;">&#40;</span>c<span style="color: black;">&#41;</span></pre></div></div>

<p>然后正常运行脚本，到了pdb.set_trace()那就会定下来，就可以看到调试的提示符(Pdb)了</p>
<p>常用的调试命令</p>
<ul>
<li>h(elp)，会打印当前版本Pdb可用的命令，如果要查询某个命令，可以输入 h [command]，例如：“h l” &#8212; 查看list命令</li>
</ul>
<ul>
<li>l(ist)，可以列出当前将要运行的代码块</li>
</ul>
<p><span style="color: #008080;">(Pdb) l<br />
497             pdb.set_trace()<br />
498             base_data = {}<br />
499             new_data = {}<br />
500             try:<br />
501                 execfile(base_file_name,{},base_data)<br />
502  -&gt;             execfile(new_file_name,{},new_data)<br />
503             except:<br />
504                 logger.writeLog(&#8220;error! load result log error!&#8221;)<br />
505                 print &#8220;load cmp logs error!&#8221;<br />
506                 raise Exception, &#8220;load cmp logs error!&#8221;<br />
507 </span></p>
<ul>
<li>b(reak)， 设置断点，例如 &#8220;b 77&#8243;，就是在当前脚本的77行打上断点，还能输入函数名作为参数，断点就打到具体的函数入口，如果只敲b，会显示现有的全部断点</li>
</ul>
<p><span style="color: #008080;">(Pdb) b 504<br />
Breakpoint 4 at /home/jchen/regression/regressionLogCMP.py:504</span></p>
<ul>
<li>condition bpnumber [condition]，设置条件断点，下面语句就是对第4个断点加上条件“a==3”</li>
</ul>
<p><span style="color: #008080;">(Pdb) condition 4 a==3<br />
(Pdb) b<br />
Num Type         Disp Enb   Where<br />
4   breakpoint    keep yes at /home/jchen/regression/regressionLogCMP.py:504<br />
stop only if a==3</span></p>
<ul>
<li>cl(ear)，如果后面带有参数，就是清除指定的断点（我在Python2.4上从来没成功过！！！）；如果不带参数就是清除所有的断点</li>
</ul>
<p><span style="color: #008080;">(Pdb) cl<br />
Clear all breaks? y</span></p>
<ul>
<li>disable/enable，禁用/激活断点</li>
</ul>
<p><span style="color: #008080;">(Pdb) disable 3<br />
(Pdb) b<br />
Num Type         Disp Enb   Where<br />
3   breakpoint    keep no  at /home/jchen/regression/regressionLogCMP.py:505</span></p>
<ul>
<li>n(ext)，让程序运行下一行，如果当前语句有一个函数调用，用n是不会进入被调用的函数体中的</li>
</ul>
<p><span id="more-640"></span></p>
<ul>
<li>s(tep)，跟n相似，但是如果当前有一个函数调用，那么s会进入被调用的函数体中</li>
</ul>
<ul>
<li>c(ont(inue))，让程序正常运行，直到遇到断点</li>
</ul>
<ul>
<li>j(ump)，让程序跳转到指定的行数</li>
</ul>
<p><span style="color: #008080;">(Pdb) j 497<br />
&gt; /home/jchen/regression/regressionLogCMP.py(497)compareLog()<br />
-&gt; pdb.set_trace()</span></p>
<ul>
<li>a(rgs)，打印当前函数的参数</li>
</ul>
<p><span style="color: #008080;">(Pdb) a<br />
_logger =<br />
_base = ./base/MRM-8137.log<br />
_new = ./new/MRM-8137.log<br />
_caseid = 5550001<br />
_toStepNum = 10<br />
_cmpMap = {&#8216;_bcmpbinarylog&#8217;: &#8216;True&#8217;, &#8216;_bcmpLog&#8217;: &#8216;True&#8217;, &#8216;_bcmpresp&#8217;: &#8216;True&#8217;}</span></p>
<ul>
<li>p，最有用的命令之一，打印某个变量</li>
</ul>
<p><span style="color: #008080;">(Pdb) p _new<br />
u&#8217;./new/MRM-8137.log&#8217;</span></p>
<ul>
<li>！，感叹号后面跟着语句，可以直接改变某个变量</li>
</ul>
<ul>
<li>q(uit)，退出调试</li>
</ul>
<p>发现在命令行下调试程序也是一件挺有意思的事情，记录下来分享一下</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://magustest.com/blog/feed/" title="RSS"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fuse-pdb-debug-python%2F&amp;title=%E7%94%A8PDB%E5%BA%93%E8%B0%83%E8%AF%95Python%E7%A8%8B%E5%BA%8F&amp;annotation=%E5%A6%82%E6%9E%9C%E4%BD%BF%E7%94%A8%E8%BF%87%E5%BE%AE%E8%BD%AF%E6%8A%80%E6%9C%AF%E7%9A%84%E6%9C%8B%E5%8F%8B%E5%BA%94%E8%AF%A5%E4%BD%93%E4%BC%9A%E8%BF%87%E5%BE%AE%E8%BD%AF%E7%9A%84Visual%20Studio%E7%B3%BB%E5%88%97IDE%E7%BB%99debug%E7%A8%8B%E5%BA%8F%E5%B8%A6%E6%9D%A5%E7%9A%84%E6%96%B9%E4%BE%BF%EF%BC%8C%E6%8D%A2%E4%BA%86%E4%B8%AA%E5%B7%A5%E4%BD%9C%E5%B0%B1%E6%B2%A1%E6%9C%89Visual%20Studio%E4%BA%86%EF%BC%8C%E5%AF%B9%E4%BA%8E%E6%88%91%E8%BF%99%E7%A7%8D%E4%BB%8E%E6%9C%AA%E5%9C%A8%E9%9D%9EGUI%E7%8E%AF%E5%A2%83%E4%B8%8B%E8%B0%83%E8%AF%95%E8%BF%87%E7%A8%8B%E5%BA%8F%E7%9A%84%E4%BA%BA%E6%9D%A5%E8%AF%B4%E5%AE%9E%E5%9C%A8%E6%9C%89%E7%82%B9%E4%B8%8D%E7%88%BD%EF%BC%8C%E4%BB%8A%E5%A4%A9" title="Google Bookmarks"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fuse-pdb-debug-python%2F&amp;title=%E7%94%A8PDB%E5%BA%93%E8%B0%83%E8%AF%95Python%E7%A8%8B%E5%BA%8F&amp;bodytext=%E5%A6%82%E6%9E%9C%E4%BD%BF%E7%94%A8%E8%BF%87%E5%BE%AE%E8%BD%AF%E6%8A%80%E6%9C%AF%E7%9A%84%E6%9C%8B%E5%8F%8B%E5%BA%94%E8%AF%A5%E4%BD%93%E4%BC%9A%E8%BF%87%E5%BE%AE%E8%BD%AF%E7%9A%84Visual%20Studio%E7%B3%BB%E5%88%97IDE%E7%BB%99debug%E7%A8%8B%E5%BA%8F%E5%B8%A6%E6%9D%A5%E7%9A%84%E6%96%B9%E4%BE%BF%EF%BC%8C%E6%8D%A2%E4%BA%86%E4%B8%AA%E5%B7%A5%E4%BD%9C%E5%B0%B1%E6%B2%A1%E6%9C%89Visual%20Studio%E4%BA%86%EF%BC%8C%E5%AF%B9%E4%BA%8E%E6%88%91%E8%BF%99%E7%A7%8D%E4%BB%8E%E6%9C%AA%E5%9C%A8%E9%9D%9EGUI%E7%8E%AF%E5%A2%83%E4%B8%8B%E8%B0%83%E8%AF%95%E8%BF%87%E7%A8%8B%E5%BA%8F%E7%9A%84%E4%BA%BA%E6%9D%A5%E8%AF%B4%E5%AE%9E%E5%9C%A8%E6%9C%89%E7%82%B9%E4%B8%8D%E7%88%BD%EF%BC%8C%E4%BB%8A%E5%A4%A9" title="Digg"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fuse-pdb-debug-python%2F&amp;title=%E7%94%A8PDB%E5%BA%93%E8%B0%83%E8%AF%95Python%E7%A8%8B%E5%BA%8F&amp;notes=%E5%A6%82%E6%9E%9C%E4%BD%BF%E7%94%A8%E8%BF%87%E5%BE%AE%E8%BD%AF%E6%8A%80%E6%9C%AF%E7%9A%84%E6%9C%8B%E5%8F%8B%E5%BA%94%E8%AF%A5%E4%BD%93%E4%BC%9A%E8%BF%87%E5%BE%AE%E8%BD%AF%E7%9A%84Visual%20Studio%E7%B3%BB%E5%88%97IDE%E7%BB%99debug%E7%A8%8B%E5%BA%8F%E5%B8%A6%E6%9D%A5%E7%9A%84%E6%96%B9%E4%BE%BF%EF%BC%8C%E6%8D%A2%E4%BA%86%E4%B8%AA%E5%B7%A5%E4%BD%9C%E5%B0%B1%E6%B2%A1%E6%9C%89Visual%20Studio%E4%BA%86%EF%BC%8C%E5%AF%B9%E4%BA%8E%E6%88%91%E8%BF%99%E7%A7%8D%E4%BB%8E%E6%9C%AA%E5%9C%A8%E9%9D%9EGUI%E7%8E%AF%E5%A2%83%E4%B8%8B%E8%B0%83%E8%AF%95%E8%BF%87%E7%A8%8B%E5%BA%8F%E7%9A%84%E4%BA%BA%E6%9D%A5%E8%AF%B4%E5%AE%9E%E5%9C%A8%E6%9C%89%E7%82%B9%E4%B8%8D%E7%88%BD%EF%BC%8C%E4%BB%8A%E5%A4%A9" title="del.icio.us"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fuse-pdb-debug-python%2F&amp;t=%E7%94%A8PDB%E5%BA%93%E8%B0%83%E8%AF%95Python%E7%A8%8B%E5%BA%8F" title="Facebook"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fuse-pdb-debug-python%2F&title=%E7%94%A8PDB%E5%BA%93%E8%B0%83%E8%AF%95Python%E7%A8%8B%E5%BA%8F" title="豆瓣"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban.png" title="豆瓣" alt="豆瓣" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fuse-pdb-debug-python%2F&title=%E7%94%A8PDB%E5%BA%93%E8%B0%83%E8%AF%95Python%E7%A8%8B%E5%BA%8F&n=1" title="豆瓣九点"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban9.png" title="豆瓣九点" alt="豆瓣九点" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.friendfeed.com/share?title=%E7%94%A8PDB%E5%BA%93%E8%B0%83%E8%AF%95Python%E7%A8%8B%E5%BA%8F&amp;link=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fuse-pdb-debug-python%2F" title="FriendFeed"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fuse-pdb-debug-python%2F&amp;title=%E7%94%A8PDB%E5%BA%93%E8%B0%83%E8%AF%95Python%E7%A8%8B%E5%BA%8F" title="Live"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fuse-pdb-debug-python%2F&amp;title=%E7%94%A8PDB%E5%BA%93%E8%B0%83%E8%AF%95Python%E7%A8%8B%E5%BA%8F&amp;body=%E5%A6%82%E6%9E%9C%E4%BD%BF%E7%94%A8%E8%BF%87%E5%BE%AE%E8%BD%AF%E6%8A%80%E6%9C%AF%E7%9A%84%E6%9C%8B%E5%8F%8B%E5%BA%94%E8%AF%A5%E4%BD%93%E4%BC%9A%E8%BF%87%E5%BE%AE%E8%BD%AF%E7%9A%84Visual%20Studio%E7%B3%BB%E5%88%97IDE%E7%BB%99debug%E7%A8%8B%E5%BA%8F%E5%B8%A6%E6%9D%A5%E7%9A%84%E6%96%B9%E4%BE%BF%EF%BC%8C%E6%8D%A2%E4%BA%86%E4%B8%AA%E5%B7%A5%E4%BD%9C%E5%B0%B1%E6%B2%A1%E6%9C%89Visual%20Studio%E4%BA%86%EF%BC%8C%E5%AF%B9%E4%BA%8E%E6%88%91%E8%BF%99%E7%A7%8D%E4%BB%8E%E6%9C%AA%E5%9C%A8%E9%9D%9EGUI%E7%8E%AF%E5%A2%83%E4%B8%8B%E8%B0%83%E8%AF%95%E8%BF%87%E7%A8%8B%E5%BA%8F%E7%9A%84%E4%BA%BA%E6%9D%A5%E8%AF%B4%E5%AE%9E%E5%9C%A8%E6%9C%89%E7%82%B9%E4%B8%8D%E7%88%BD%EF%BC%8C%E4%BB%8A%E5%A4%A9" title="Ping.fm"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=%E7%94%A8PDB%E5%BA%93%E8%B0%83%E8%AF%95Python%E7%A8%8B%E5%BA%8F&uri=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fuse-pdb-debug-python%2F" title="QQ书签"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=%E7%94%A8PDB%E5%BA%93%E8%B0%83%E8%AF%95Python%E7%A8%8B%E5%BA%8F%20-%20http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fuse-pdb-debug-python%2F" title="Twitter"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://magustest.com/blog/computer/use-pdb-debug-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在Lua中实现简单的StringBuffer</title>
		<link>http://magustest.com/blog/uncategorized/stringbuffer-in-lua/</link>
		<comments>http://magustest.com/blog/uncategorized/stringbuffer-in-lua/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 09:12:08 +0000</pubDate>
		<dc:creator>magus</dc:creator>
				<category><![CDATA[未分类]]></category>
		<category><![CDATA[Lua]]></category>

		<guid isPermaLink="false">http://magustest.com/blog/?p=596</guid>
		<description><![CDATA[在Lua中，字符串是一个常量，如果用字符串连接符“..”把2个字符串连接起来，例如first_str = first_str .. second_str，那么原来的first_str和second_str就会作为垃圾等待回收，first_str引用的是一个新的字符串，如果在程序里面有大量的字符串连接操作的话，性能会十分低下。Lua是一个很简洁的语言，他没有StringBuffer的实现，但是其实我们可以动手写一个简单的StringBuffer实现，来避免性能的问题。 首先定义一个叫StringBuffer的table，使得这个StringBuffer被调用的时候看起来像是面向对象的样子 ：） 然后分别定义两个方法append和tostr，实现的原理就是：append用table来保存所有字符串，tostr把保存了字符串的table用concat转成真正的字符串。 StringBuffer = &#123;&#125; StringBuffer.append = function&#40;t, str&#41; if t and str then table.insert&#40;t, str&#41; end end StringBuffer.tostr = function&#40;t&#41; if t then return table.concat&#40;t&#41; end end StringBuffer.new = function&#40;&#41; return &#123;&#125; end 调用的时候大概如下，摘录了一段代码。。。 all_assets = StringBuffer.new&#40;&#41; for asset in ctx:allassets&#40;&#41; do StringBuffer.append&#40;all_assets, asset:id&#40;&#41;&#41; StringBuffer.append&#40;all_assets, ', '&#41; end [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>在Lua中，字符串是一个常量，如果用字符串连接符“..”把2个字符串连接起来，例如first_str = first_str .. second_str，那么原来的first_str和second_str就会作为垃圾等待回收，first_str引用的是一个新的字符串，如果在程序里面有大量的字符串连接操作的话，性能会十分低下。Lua是一个很简洁的语言，他没有StringBuffer的实现，但是其实我们可以动手写一个简单的StringBuffer实现，来避免性能的问题。</p>
<p>首先定义一个叫StringBuffer的table，使得这个StringBuffer被调用的时候看起来像是面向对象的样子 ：）<br />
然后分别定义两个方法append和tostr，实现的原理就是：append用table来保存所有字符串，tostr把保存了字符串的table用concat转成真正的字符串。</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;">StringBuffer <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>
StringBuffer.append <span style="color: #66cc66;">=</span>  <span style="color: #b1b100;">function</span><span style="color: #66cc66;">&#40;</span>t, str<span style="color: #66cc66;">&#41;</span>
<span style="color: #b1b100;">if</span> t <span style="color: #b1b100;">and</span> str <span style="color: #b1b100;">then</span>
    <span style="color: #b1b100;">table.insert</span><span style="color: #66cc66;">&#40;</span>t, str<span style="color: #66cc66;">&#41;</span>
<span style="color: #b1b100;">end</span>
<span style="color: #b1b100;">end</span>
StringBuffer.tostr <span style="color: #66cc66;">=</span>  <span style="color: #b1b100;">function</span><span style="color: #66cc66;">&#40;</span>t<span style="color: #66cc66;">&#41;</span>
<span style="color: #b1b100;">if</span> t <span style="color: #b1b100;">then</span>
    <span style="color: #b1b100;">return</span> <span style="color: #b1b100;">table.concat</span><span style="color: #66cc66;">&#40;</span>t<span style="color: #66cc66;">&#41;</span>
<span style="color: #b1b100;">end</span>
<span style="color: #b1b100;">end</span>
StringBuffer.new <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">end</span></pre></div></div>

<p>调用的时候大概如下，摘录了一段代码。。。</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;">all_assets <span style="color: #66cc66;">=</span> StringBuffer.new<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #b1b100;">for</span> asset <span style="color: #b1b100;">in</span> ctx:allassets<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">do</span>
    StringBuffer.append<span style="color: #66cc66;">&#40;</span>all_assets, asset:id<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    StringBuffer.append<span style="color: #66cc66;">&#40;</span>all_assets, <span style="color: #ff0000;">', '</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #b1b100;">end</span>
result <span style="color: #66cc66;">=</span> StringBuffer.tostr<span style="color: #66cc66;">&#40;</span>all_assets<span style="color: #66cc66;">&#41;</span>
<span style="color: #b1b100;">print</span> <span style="color: #66cc66;">&#40;</span>result<span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>在Lua中实现这样的一个StringBuffer，既可以避免潜在的性能问题，又可以使得代码看起来更加易懂~好了，重构以前的代码去了。。。</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://magustest.com/blog/feed/" title="RSS"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fstringbuffer-in-lua%2F&amp;title=%E5%9C%A8Lua%E4%B8%AD%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84StringBuffer&amp;annotation=%E5%9C%A8Lua%E4%B8%AD%EF%BC%8C%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%98%AF%E4%B8%80%E4%B8%AA%E5%B8%B8%E9%87%8F%EF%BC%8C%E5%A6%82%E6%9E%9C%E7%94%A8%E5%AD%97%E7%AC%A6%E4%B8%B2%E8%BF%9E%E6%8E%A5%E7%AC%A6%E2%80%9C..%E2%80%9D%E6%8A%8A2%E4%B8%AA%E5%AD%97%E7%AC%A6%E4%B8%B2%E8%BF%9E%E6%8E%A5%E8%B5%B7%E6%9D%A5%EF%BC%8C%E4%BE%8B%E5%A6%82first_str%20%3D%20first_str%20..%20second_str%EF%BC%8C%E9%82%A3%E4%B9%88%E5%8E%9F%E6%9D%A5%E7%9A%84first_str%E5%92%8Csecond_str%E5%B0%B1%E4%BC%9A%E4%BD%9C%E4%B8%BA%E5%9E%83%E5%9C%BE%E7%AD%89%E5%BE%85%E5%9B%9E%E6%94%B6%EF%BC%8Cfirst_str%E5%BC%95%E7%94%A8%E7%9A%84%E6%98%AF%E4%B8%80%E4%B8%AA%E6%96%B0%E7" title="Google Bookmarks"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fstringbuffer-in-lua%2F&amp;title=%E5%9C%A8Lua%E4%B8%AD%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84StringBuffer&amp;bodytext=%E5%9C%A8Lua%E4%B8%AD%EF%BC%8C%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%98%AF%E4%B8%80%E4%B8%AA%E5%B8%B8%E9%87%8F%EF%BC%8C%E5%A6%82%E6%9E%9C%E7%94%A8%E5%AD%97%E7%AC%A6%E4%B8%B2%E8%BF%9E%E6%8E%A5%E7%AC%A6%E2%80%9C..%E2%80%9D%E6%8A%8A2%E4%B8%AA%E5%AD%97%E7%AC%A6%E4%B8%B2%E8%BF%9E%E6%8E%A5%E8%B5%B7%E6%9D%A5%EF%BC%8C%E4%BE%8B%E5%A6%82first_str%20%3D%20first_str%20..%20second_str%EF%BC%8C%E9%82%A3%E4%B9%88%E5%8E%9F%E6%9D%A5%E7%9A%84first_str%E5%92%8Csecond_str%E5%B0%B1%E4%BC%9A%E4%BD%9C%E4%B8%BA%E5%9E%83%E5%9C%BE%E7%AD%89%E5%BE%85%E5%9B%9E%E6%94%B6%EF%BC%8Cfirst_str%E5%BC%95%E7%94%A8%E7%9A%84%E6%98%AF%E4%B8%80%E4%B8%AA%E6%96%B0%E7" title="Digg"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fstringbuffer-in-lua%2F&amp;title=%E5%9C%A8Lua%E4%B8%AD%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84StringBuffer&amp;notes=%E5%9C%A8Lua%E4%B8%AD%EF%BC%8C%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%98%AF%E4%B8%80%E4%B8%AA%E5%B8%B8%E9%87%8F%EF%BC%8C%E5%A6%82%E6%9E%9C%E7%94%A8%E5%AD%97%E7%AC%A6%E4%B8%B2%E8%BF%9E%E6%8E%A5%E7%AC%A6%E2%80%9C..%E2%80%9D%E6%8A%8A2%E4%B8%AA%E5%AD%97%E7%AC%A6%E4%B8%B2%E8%BF%9E%E6%8E%A5%E8%B5%B7%E6%9D%A5%EF%BC%8C%E4%BE%8B%E5%A6%82first_str%20%3D%20first_str%20..%20second_str%EF%BC%8C%E9%82%A3%E4%B9%88%E5%8E%9F%E6%9D%A5%E7%9A%84first_str%E5%92%8Csecond_str%E5%B0%B1%E4%BC%9A%E4%BD%9C%E4%B8%BA%E5%9E%83%E5%9C%BE%E7%AD%89%E5%BE%85%E5%9B%9E%E6%94%B6%EF%BC%8Cfirst_str%E5%BC%95%E7%94%A8%E7%9A%84%E6%98%AF%E4%B8%80%E4%B8%AA%E6%96%B0%E7" title="del.icio.us"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fstringbuffer-in-lua%2F&amp;t=%E5%9C%A8Lua%E4%B8%AD%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84StringBuffer" title="Facebook"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fstringbuffer-in-lua%2F&title=%E5%9C%A8Lua%E4%B8%AD%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84StringBuffer" title="豆瓣"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban.png" title="豆瓣" alt="豆瓣" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fstringbuffer-in-lua%2F&title=%E5%9C%A8Lua%E4%B8%AD%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84StringBuffer&n=1" title="豆瓣九点"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban9.png" title="豆瓣九点" alt="豆瓣九点" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.friendfeed.com/share?title=%E5%9C%A8Lua%E4%B8%AD%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84StringBuffer&amp;link=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fstringbuffer-in-lua%2F" title="FriendFeed"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fstringbuffer-in-lua%2F&amp;title=%E5%9C%A8Lua%E4%B8%AD%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84StringBuffer" title="Live"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fstringbuffer-in-lua%2F&amp;title=%E5%9C%A8Lua%E4%B8%AD%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84StringBuffer&amp;body=%E5%9C%A8Lua%E4%B8%AD%EF%BC%8C%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%98%AF%E4%B8%80%E4%B8%AA%E5%B8%B8%E9%87%8F%EF%BC%8C%E5%A6%82%E6%9E%9C%E7%94%A8%E5%AD%97%E7%AC%A6%E4%B8%B2%E8%BF%9E%E6%8E%A5%E7%AC%A6%E2%80%9C..%E2%80%9D%E6%8A%8A2%E4%B8%AA%E5%AD%97%E7%AC%A6%E4%B8%B2%E8%BF%9E%E6%8E%A5%E8%B5%B7%E6%9D%A5%EF%BC%8C%E4%BE%8B%E5%A6%82first_str%20%3D%20first_str%20..%20second_str%EF%BC%8C%E9%82%A3%E4%B9%88%E5%8E%9F%E6%9D%A5%E7%9A%84first_str%E5%92%8Csecond_str%E5%B0%B1%E4%BC%9A%E4%BD%9C%E4%B8%BA%E5%9E%83%E5%9C%BE%E7%AD%89%E5%BE%85%E5%9B%9E%E6%94%B6%EF%BC%8Cfirst_str%E5%BC%95%E7%94%A8%E7%9A%84%E6%98%AF%E4%B8%80%E4%B8%AA%E6%96%B0%E7" title="Ping.fm"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=%E5%9C%A8Lua%E4%B8%AD%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84StringBuffer&uri=http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fstringbuffer-in-lua%2F" title="QQ书签"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=%E5%9C%A8Lua%E4%B8%AD%E5%AE%9E%E7%8E%B0%E7%AE%80%E5%8D%95%E7%9A%84StringBuffer%20-%20http%3A%2F%2Fmagustest.com%2Fblog%2Funcategorized%2Fstringbuffer-in-lua%2F" title="Twitter"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://magustest.com/blog/uncategorized/stringbuffer-in-lua/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>敏捷测试只是手段不是目的</title>
		<link>http://magustest.com/blog/softwaretesting/about-agile-testing/</link>
		<comments>http://magustest.com/blog/softwaretesting/about-agile-testing/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 10:09:18 +0000</pubDate>
		<dc:creator>magus</dc:creator>
				<category><![CDATA[软件测试]]></category>
		<category><![CDATA[敏捷测试]]></category>

		<guid isPermaLink="false">http://magustest.com/blog/?p=592</guid>
		<description><![CDATA[首先我要声明：本人不懂敏捷测试。 敏捷开发在这两年一直很火，很多时候作为一个测试人员，经常会“被敏捷”。一些常见的现象有，当你所要文档的时候，相关人员可能会告诉你“我们是敏捷开发，没有文档”；当你索要进度表的时候，答案也是相似的。既然软件开发已经迈入了敏捷时代，那么软件测试还能原地踏步麽？那什么是敏捷测试？我不知道，不过我想说说我在“敏捷”组织里面进行软件测试的经历。 由于我不懂敏捷测试，所以我不知道它的定义，我只能通过“敏捷测试不是传统测试”这样的思路来开展工作。 首先，那种拿着各种需求文档设计文档来设计Test Case的日子是一去不复返了，因为敏捷开发强调的是能工作的软件比漂亮的文档要有用，人和人之间的沟通胜于文档。所以作为我，一个测试员，我对被测软件的知识的了解来源有2个方面，第一是代码，第二是开发人员。 其次，如果在测试过程中发现一个问题，第一件事情并不是把这个问题记录在Tracking system里面，而是找相关的开发和产品进行确认，究竟这是不是一个真的Defect。 然后，需要知道一个现在很流行的新玩意儿：探索性测试（Exploratory Testing）。每个人对Exploratory Testing的定义都不一样，最近两个大牛（James Bach, James Whittaker）也在掐架。我觉得如果简化这个定义的话，就是我们一边熟悉被测软件，一边进行测试，在测试进行的过程中，随着对软件的熟悉，继而设计出新的Test case来对被测软件进行测试，我个人觉得就像是一个小的迭代一样。 最后，忘记敏捷测试这个词。我觉得现在业界能说清楚这个概念的人很少，所以没有必要在这些定义上纠结。人们为什么要实施敏捷开发，是因为想交付更好的软件；我们为什么要实施敏捷测试，是想提高测试的质量以及生产力，从而帮助公司交付更加高质量的产品，至于是不是真正的敏捷，又有什么重要的呢 Share and Enjoy: Related posts:推荐阅读：5 Ways to Revolutionize Your QA


Related posts:<ol><li><a href='http://magustest.com/blog/softwaretesting/5-ways-to-revolutionize-your-qa/' rel='bookmark' title='Permanent Link: 推荐阅读：5 Ways to Revolutionize Your QA'>推荐阅读：5 Ways to Revolutionize Your QA</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>首先我要声明：本人不懂敏捷测试。<br />
敏捷开发在这两年一直很火，很多时候作为一个测试人员，经常会“被敏捷”。一些常见的现象有，当你所要文档的时候，相关人员可能会告诉你“我们是敏捷开发，没有文档”；当你索要进度表的时候，答案也是相似的。既然软件开发已经迈入了敏捷时代，那么软件测试还能原地踏步麽？那什么是敏捷测试？我不知道，不过我想说说我在“敏捷”组织里面进行软件测试的经历。<br />
由于我不懂敏捷测试，所以我不知道它的定义，我只能通过“敏捷测试不是传统测试”这样的思路来开展工作。<br />
首先，那种拿着各种需求文档设计文档来设计Test Case的日子是一去不复返了，因为敏捷开发强调的是能工作的软件比漂亮的文档要有用，人和人之间的沟通胜于文档。所以作为我，一个测试员，我对被测软件的知识的了解来源有2个方面，第一是代码，第二是开发人员。<br />
其次，如果在测试过程中发现一个问题，第一件事情并不是把这个问题记录在Tracking system里面，而是找相关的开发和产品进行确认，究竟这是不是一个真的Defect。<br />
然后，需要知道一个现在很流行的新玩意儿：探索性测试（<a href="http://en.wikipedia.org/wiki/Exploratory_testing" target="_blank">Exploratory Testing</a>）。每个人对Exploratory Testing的定义都不一样，最近两个大牛（<a href="http://www.satisfice.com/" target="_blank">James Bach</a>, <a href="http://blogs.msdn.com/james_whittaker/default.aspx" target="_blank">James Whittaker</a>）也在掐架。我觉得如果简化这个定义的话，就是我们一边熟悉被测软件，一边进行测试，在测试进行的过程中，随着对软件的熟悉，继而设计出新的Test case来对被测软件进行测试，我个人觉得就像是一个小的迭代一样。<br />
最后，忘记敏捷测试这个词。我觉得现在业界能说清楚这个概念的人很少，所以没有必要在这些定义上纠结。人们为什么要实施敏捷开发，是因为想交付更好的软件；我们为什么要实施敏捷测试，是想提高测试的质量以及生产力，从而帮助公司交付更加高质量的产品，至于是不是真正的敏捷，又有什么重要的呢</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://magustest.com/blog/feed/" title="RSS"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Fabout-agile-testing%2F&amp;t=%E6%95%8F%E6%8D%B7%E6%B5%8B%E8%AF%95%E5%8F%AA%E6%98%AF%E6%89%8B%E6%AE%B5%E4%B8%8D%E6%98%AF%E7%9B%AE%E7%9A%84" title="Facebook"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Fabout-agile-testing%2F&title=%E6%95%8F%E6%8D%B7%E6%B5%8B%E8%AF%95%E5%8F%AA%E6%98%AF%E6%89%8B%E6%AE%B5%E4%B8%8D%E6%98%AF%E7%9B%AE%E7%9A%84" title="豆瓣"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban.png" title="豆瓣" alt="豆瓣" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.douban.com/recommend/?url=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Fabout-agile-testing%2F&title=%E6%95%8F%E6%8D%B7%E6%B5%8B%E8%AF%95%E5%8F%AA%E6%98%AF%E6%89%8B%E6%AE%B5%E4%B8%8D%E6%98%AF%E7%9B%AE%E7%9A%84&n=1" title="豆瓣九点"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/douban9.png" title="豆瓣九点" alt="豆瓣九点" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.friendfeed.com/share?title=%E6%95%8F%E6%8D%B7%E6%B5%8B%E8%AF%95%E5%8F%AA%E6%98%AF%E6%89%8B%E6%AE%B5%E4%B8%8D%E6%98%AF%E7%9B%AE%E7%9A%84&amp;link=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Fabout-agile-testing%2F" title="FriendFeed"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Fabout-agile-testing%2F&amp;title=%E6%95%8F%E6%8D%B7%E6%B5%8B%E8%AF%95%E5%8F%AA%E6%98%AF%E6%89%8B%E6%AE%B5%E4%B8%8D%E6%98%AF%E7%9B%AE%E7%9A%84" title="Live"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<img src="http://magustest.com/blog/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://shuqian.qq.com/post?jumpback=1&title=%E6%95%8F%E6%8D%B7%E6%B5%8B%E8%AF%95%E5%8F%AA%E6%98%AF%E6%89%8B%E6%AE%B5%E4%B8%8D%E6%98%AF%E7%9B%AE%E7%9A%84&uri=http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Fabout-agile-testing%2F" title="QQ书签"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/qq.png" title="QQ书签" alt="QQ书签" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=%E6%95%8F%E6%8D%B7%E6%B5%8B%E8%AF%95%E5%8F%AA%E6%98%AF%E6%89%8B%E6%AE%B5%E4%B8%8D%E6%98%AF%E7%9B%AE%E7%9A%84%20-%20http%3A%2F%2Fmagustest.com%2Fblog%2Fsoftwaretesting%2Fabout-agile-testing%2F" title="Twitter"><img src="http://magustest.com/blog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>

<p>Related posts:<ol><li><a href='http://magustest.com/blog/softwaretesting/5-ways-to-revolutionize-your-qa/' rel='bookmark' title='Permanent Link: 推荐阅读：5 Ways to Revolutionize Your QA'>推荐阅读：5 Ways to Revolutionize Your QA</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://magustest.com/blog/softwaretesting/about-agile-testing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
