<?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>Thu, 31 Dec 2009 15:58:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<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>1</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; [...]


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
result = StringBuffer.tostr&#40;all_assets&#41;
print [...]


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>0</slash:comments>
		</item>
		<item>
		<title>用Python修改含有日期的文件名</title>
		<link>http://magustest.com/blog/linux/modify-filename-using-pytho/</link>
		<comments>http://magustest.com/blog/linux/modify-filename-using-pytho/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 10:15:35 +0000</pubDate>
		<dc:creator>magus</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://magustest.com/blog/?p=587</guid>
		<description><![CDATA[问题：修要修改一些LOG FILE的名字，那些LOG FILE的文件名格式大概是 log-v0-20091012-daily-1a5019a0.csv 。需要修改红色的日期部分，把这个日期改小一点，例如改到20091001。
首先上程序：

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import time, os, string, sys
ONE_DAY = &#40;24 * 60 * 60&#41;
if __name__ == &#34;__main__&#34;:
    if len&#40;sys.argv&#41;&#38;lt;2:
        print &#34;argv error, useage: python &#34; + __file__ + &#34; foldername int&#34;
        sys.exit&#40;&#41;
    if len&#40;sys.argv&#41;==2:
 [...]


Related posts:<ol><li><a href='http://magustest.com/blog/softwaretesting/warmup-asp-net-website/' rel='bookmark' title='Permanent Link: 用Python脚本对ASP.NET站点进行预热'>用Python脚本对ASP.NET站点进行预热</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>问题：修要修改一些LOG FILE的名字，那些LOG FILE的文件名格式大概是 log-v0-<span style="color: #ff0000;">20091012</span>-daily-1a5019a0.csv 。需要修改红色的日期部分，把这个日期改小一点，例如改到20091001。</p>
<p>首先上程序：</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
14
15
16
17
18
19
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">time</span>, <span style="color: #dc143c;">os</span>, <span style="color: #dc143c;">string</span>, <span style="color: #dc143c;">sys</span>
ONE_DAY = <span style="color: black;">&#40;</span><span style="color: #ff4500;">24</span> <span style="color: #66cc66;">*</span> <span style="color: #ff4500;">60</span> <span style="color: #66cc66;">*</span> <span style="color: #ff4500;">60</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">&amp;</span>lt<span style="color: #66cc66;">;</span><span style="color: #ff4500;">2</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;argv error, useage: python &quot;</span> + __file__ + <span style="color: #483d8b;">&quot; foldername int&quot;</span>
        <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span>==<span style="color: #ff4500;">2</span>:
        intrday = <span style="color: #ff4500;">1</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        intrday = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
    folder = <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
    localtime = <span style="color: #dc143c;">time</span>.<span style="color: black;">localtime</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    todate = <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>localtime<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>localtime<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>localtime<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
    targettime = <span style="color: #dc143c;">time</span>.<span style="color: black;">localtime</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> - ONE_DAY<span style="color: #66cc66;">*</span>intrday<span style="color: black;">&#41;</span>
    newdate = <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>targettime<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>targettime<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>targettime<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> folder
    <span style="color: #ff7700;font-weight:bold;">for</span> <span style="color: #008000;">file</span> <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">listdir</span><span style="color: black;">&#40;</span>folder<span style="color: black;">&#41;</span>:
        newname = <span style="color: #dc143c;">string</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">string</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #008000;">file</span>, todate<span style="color: black;">&#41;</span>, newdate<span style="color: black;">&#41;</span>
        <span style="color: #dc143c;">os</span>.<span style="color: black;">rename</span><span style="color: black;">&#40;</span>folder+<span style="color: #008000;">file</span>, folder+newname<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>用的时候就是 $ python rename.py ./ 4 ；这个命令会把当前目录下面符合这个条件的文件名中的日期往前改4天，运行完了以后的文件名就是：log-v0-<span style="color: #ff0000;">20091008</span>-daily-1a5019a0.csv</p>
<p>如果还需要把文件的访问时间和修改时间也一并修改的话，那么只需要用os.utime(path, times)这个函数就好了，times是元组(Tuple)，一般可以这样用：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">time_for_utime = <span style="color: black;">&#40;</span><span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>, <span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
<span style="color: #dc143c;">os</span>.<span style="color: black;">utime</span><span style="color: black;">&#40;</span>path, time_for_utime<span style="color: black;">&#41;</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%2Flinux%2Fmodify-filename-using-pytho%2F&amp;title=%E7%94%A8Python%E4%BF%AE%E6%94%B9%E5%90%AB%E6%9C%89%E6%97%A5%E6%9C%9F%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D&amp;annotation=%E9%97%AE%E9%A2%98%EF%BC%9A%E4%BF%AE%E8%A6%81%E4%BF%AE%E6%94%B9%E4%B8%80%E4%BA%9BLOG%20FILE%E7%9A%84%E5%90%8D%E5%AD%97%EF%BC%8C%E9%82%A3%E4%BA%9BLOG%20FILE%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D%E6%A0%BC%E5%BC%8F%E5%A4%A7%E6%A6%82%E6%98%AF%20log-v0-20091012-daily-1a5019a0.csv%20%E3%80%82%E9%9C%80%E8%A6%81%E4%BF%AE%E6%94%B9%E7%BA%A2%E8%89%B2%E7%9A%84%E6%97%A5%E6%9C%9F%E9%83%A8%E5%88%86%EF%BC%8C%E6%8A%8A%E8%BF%99%E4%B8%AA%E6%97%A5%E6%9C%9F%E6%94%B9%E5%B0%8F%E4%B8%80%E7%82%B9%EF%BC%8C%E4%BE%8B%E5%A6%82%E6%94%B9%E5%88%B020091001%E3%80%82%0D%0A%0D%0A%E9%A6%96%E5%85%88%E4%B8%8A%E7%A8%8B%E5%BA%8F%EF%BC%9A%0D%0Aimport%20tim" 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%2Flinux%2Fmodify-filename-using-pytho%2F&amp;title=%E7%94%A8Python%E4%BF%AE%E6%94%B9%E5%90%AB%E6%9C%89%E6%97%A5%E6%9C%9F%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D&amp;bodytext=%E9%97%AE%E9%A2%98%EF%BC%9A%E4%BF%AE%E8%A6%81%E4%BF%AE%E6%94%B9%E4%B8%80%E4%BA%9BLOG%20FILE%E7%9A%84%E5%90%8D%E5%AD%97%EF%BC%8C%E9%82%A3%E4%BA%9BLOG%20FILE%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D%E6%A0%BC%E5%BC%8F%E5%A4%A7%E6%A6%82%E6%98%AF%20log-v0-20091012-daily-1a5019a0.csv%20%E3%80%82%E9%9C%80%E8%A6%81%E4%BF%AE%E6%94%B9%E7%BA%A2%E8%89%B2%E7%9A%84%E6%97%A5%E6%9C%9F%E9%83%A8%E5%88%86%EF%BC%8C%E6%8A%8A%E8%BF%99%E4%B8%AA%E6%97%A5%E6%9C%9F%E6%94%B9%E5%B0%8F%E4%B8%80%E7%82%B9%EF%BC%8C%E4%BE%8B%E5%A6%82%E6%94%B9%E5%88%B020091001%E3%80%82%0D%0A%0D%0A%E9%A6%96%E5%85%88%E4%B8%8A%E7%A8%8B%E5%BA%8F%EF%BC%9A%0D%0Aimport%20tim" 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%2Flinux%2Fmodify-filename-using-pytho%2F&amp;title=%E7%94%A8Python%E4%BF%AE%E6%94%B9%E5%90%AB%E6%9C%89%E6%97%A5%E6%9C%9F%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D&amp;notes=%E9%97%AE%E9%A2%98%EF%BC%9A%E4%BF%AE%E8%A6%81%E4%BF%AE%E6%94%B9%E4%B8%80%E4%BA%9BLOG%20FILE%E7%9A%84%E5%90%8D%E5%AD%97%EF%BC%8C%E9%82%A3%E4%BA%9BLOG%20FILE%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D%E6%A0%BC%E5%BC%8F%E5%A4%A7%E6%A6%82%E6%98%AF%20log-v0-20091012-daily-1a5019a0.csv%20%E3%80%82%E9%9C%80%E8%A6%81%E4%BF%AE%E6%94%B9%E7%BA%A2%E8%89%B2%E7%9A%84%E6%97%A5%E6%9C%9F%E9%83%A8%E5%88%86%EF%BC%8C%E6%8A%8A%E8%BF%99%E4%B8%AA%E6%97%A5%E6%9C%9F%E6%94%B9%E5%B0%8F%E4%B8%80%E7%82%B9%EF%BC%8C%E4%BE%8B%E5%A6%82%E6%94%B9%E5%88%B020091001%E3%80%82%0D%0A%0D%0A%E9%A6%96%E5%85%88%E4%B8%8A%E7%A8%8B%E5%BA%8F%EF%BC%9A%0D%0Aimport%20tim" 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%2Flinux%2Fmodify-filename-using-pytho%2F&amp;t=%E7%94%A8Python%E4%BF%AE%E6%94%B9%E5%90%AB%E6%9C%89%E6%97%A5%E6%9C%9F%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D" 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%2Flinux%2Fmodify-filename-using-pytho%2F&title=%E7%94%A8Python%E4%BF%AE%E6%94%B9%E5%90%AB%E6%9C%89%E6%97%A5%E6%9C%9F%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D" 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%2Flinux%2Fmodify-filename-using-pytho%2F&title=%E7%94%A8Python%E4%BF%AE%E6%94%B9%E5%90%AB%E6%9C%89%E6%97%A5%E6%9C%9F%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D&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%A8Python%E4%BF%AE%E6%94%B9%E5%90%AB%E6%9C%89%E6%97%A5%E6%9C%9F%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D&amp;link=http%3A%2F%2Fmagustest.com%2Fblog%2Flinux%2Fmodify-filename-using-pytho%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%2Flinux%2Fmodify-filename-using-pytho%2F&amp;title=%E7%94%A8Python%E4%BF%AE%E6%94%B9%E5%90%AB%E6%9C%89%E6%97%A5%E6%9C%9F%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D" 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%2Flinux%2Fmodify-filename-using-pytho%2F&amp;title=%E7%94%A8Python%E4%BF%AE%E6%94%B9%E5%90%AB%E6%9C%89%E6%97%A5%E6%9C%9F%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D&amp;body=%E9%97%AE%E9%A2%98%EF%BC%9A%E4%BF%AE%E8%A6%81%E4%BF%AE%E6%94%B9%E4%B8%80%E4%BA%9BLOG%20FILE%E7%9A%84%E5%90%8D%E5%AD%97%EF%BC%8C%E9%82%A3%E4%BA%9BLOG%20FILE%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D%E6%A0%BC%E5%BC%8F%E5%A4%A7%E6%A6%82%E6%98%AF%20log-v0-20091012-daily-1a5019a0.csv%20%E3%80%82%E9%9C%80%E8%A6%81%E4%BF%AE%E6%94%B9%E7%BA%A2%E8%89%B2%E7%9A%84%E6%97%A5%E6%9C%9F%E9%83%A8%E5%88%86%EF%BC%8C%E6%8A%8A%E8%BF%99%E4%B8%AA%E6%97%A5%E6%9C%9F%E6%94%B9%E5%B0%8F%E4%B8%80%E7%82%B9%EF%BC%8C%E4%BE%8B%E5%A6%82%E6%94%B9%E5%88%B020091001%E3%80%82%0D%0A%0D%0A%E9%A6%96%E5%85%88%E4%B8%8A%E7%A8%8B%E5%BA%8F%EF%BC%9A%0D%0Aimport%20tim" 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%A8Python%E4%BF%AE%E6%94%B9%E5%90%AB%E6%9C%89%E6%97%A5%E6%9C%9F%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D&uri=http%3A%2F%2Fmagustest.com%2Fblog%2Flinux%2Fmodify-filename-using-pytho%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%A8Python%E4%BF%AE%E6%94%B9%E5%90%AB%E6%9C%89%E6%97%A5%E6%9C%9F%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D%20-%20http%3A%2F%2Fmagustest.com%2Fblog%2Flinux%2Fmodify-filename-using-pytho%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/warmup-asp-net-website/' rel='bookmark' title='Permanent Link: 用Python脚本对ASP.NET站点进行预热'>用Python脚本对ASP.NET站点进行预热</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://magustest.com/blog/linux/modify-filename-using-pytho/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux下的snmpd.conf配置说明</title>
		<link>http://magustest.com/blog/linux/setup-snmpd-conf/</link>
		<comments>http://magustest.com/blog/linux/setup-snmpd-conf/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 13:52:10 +0000</pubDate>
		<dc:creator>magus</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://magustest.com/blog/?p=584</guid>
		<description><![CDATA[SNMP(Simple Network Management Protocol,简单网络管理协议)的前身是简单网关监控协议(SGMP)，用来对通信线路进行管理。在RHEL中，SNMP的配置文件地址是/etc/snmp/snmpd.conf。snmpd.conf的配置项很多，但是真正常用的就那么几个，下面来逐个介绍。
com2sec命令，它的基本语法是“com2sec NAME SOURCE COMMUNITY”。这里要提一下SNMP的安全策略，其实SNMP的安全性并不好，在这个协议中使用COMMUNITY这个东西来做访问控制的。简单来理解就是现在有一个帮会的一个人找去了总舵，那么这个人怎么跟总舵相认呢？他们直接约定一个“暗号”，例如见面就说“床前明月光”，那么总舵的前台就会带你去“床前明月光”想对应的地方。现在回过头来看这行配置，假如有以下一句话
com2sec  magusu default  magus
意思就是做一个映射，把magus这个COMMUNITY串和magusu这个名字做好一对映射，那么以后在调用SNMP的时候，只要你声明你就是magus，那么就可以获得相应的权限了。有了映射以后下面需要做的是建立一个从magusu到组的一个映射，用到的命令是group，它的基本语法是“group NAME MODEL SECURITY”
group  magusg v2c  magusu
上面这句话的意思就是把magusu放到组magusg里面，用的协议是v2c，插一句，SNMP现在通常用的有3个版本。那好了，组建好了下来要做什么呢？就是要建立一个VIEW，VIEW的基本语法是“view NAME TYPE SUBTREE [MASK]”
view  magusv  included  .1.3.6.1.4.1.9129
像上面这句话的意思就是赋予magusv这个view能够查看1.3.6.1.4.1.9129下面所有节点的权限。最后要做的是设定哪些组的人，哪些view的用户可以做什么具体的事情，用access来设置，基本语法是“access NAME CONTEXT MODEL LEVEL PREFX READ WRITE NOTIFY”。
access   magusg   “”   any   noauth   exact   magusv   magusv   none
由于例子中用的是v2c版本的协议，所以CONTEXT必须为空，MODEL也就是协议的版本号，在这里例子里面可以是any也可以是v2c，还是由于v2c的缘故，所以LEVEL是noauth；READ、WRITE和NOTIFY分别需要指定一个view或者什么都不指定；在这里的设置就是magusv这个view可以对前面设置好的节点进行读和写操作。
到此，服务端的配置已经完成，重启一下snmpd就可以了，下面看看如何通过SNMP得到我们想要的数据
snmpwalk -v 2c -c magus localhost 1.3.6.1.4.1.9129.1.2.2
snmpwalk可以便利指定节点下的所有子节点，-v 参数指定SNMP的协议版本，这个跟我们之前配置服务器的版本是要一致的，也就是2c，然后-c参数就指定了community的字符串，也就是刚才定义的magus，然后就是主机地址，由于我在本机测试，所以用的localhost，实际中可以填上IP，最后就是OID的值。搞定！
对于刚刚接触SNMP的朋友来说，理解community的作用是关键，其实说的通俗点就是接头暗号，而且还是个明文的“暗号”。



Share and Enjoy:


	
	
	
	
	
	
	
	
	
	
	
	
	




No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>SNMP(Simple Network Management Protocol,简单网络管理协议)的前身是简单网关监控协议(SGMP)，用来对通信线路进行管理。在RHEL中，SNMP的配置文件地址是/etc/snmp/snmpd.conf。snmpd.conf的配置项很多，但是真正常用的就那么几个，下面来逐个介绍。</p>
<p>com2sec命令，它的基本语法是“com2sec NAME SOURCE COMMUNITY”。这里要提一下SNMP的安全策略，其实SNMP的安全性并不好，在这个协议中使用COMMUNITY这个东西来做访问控制的。简单来理解就是现在有一个帮会的一个人找去了总舵，那么这个人怎么跟总舵相认呢？他们直接约定一个“暗号”，例如见面就说“床前明月光”，那么总舵的前台就会带你去“床前明月光”想对应的地方。现在回过头来看这行配置，假如有以下一句话</p>
<blockquote><p>com2sec  magusu default  magus</p></blockquote>
<p>意思就是做一个映射，把magus这个COMMUNITY串和magusu这个名字做好一对映射，那么以后在调用SNMP的时候，只要你声明你就是magus，那么就可以获得相应的权限了。有了映射以后下面需要做的是建立一个从magusu到组的一个映射，用到的命令是group，它的基本语法是“group NAME MODEL SECURITY”</p>
<blockquote><p>group  magusg v2c  magusu</p></blockquote>
<p>上面这句话的意思就是把magusu放到组magusg里面，用的协议是v2c，插一句，SNMP现在通常用的有3个版本。那好了，组建好了下来要做什么呢？就是要建立一个VIEW，VIEW的基本语法是“view NAME TYPE SUBTREE [MASK]”</p>
<blockquote><p>view  magusv  included  .1.3.6.1.4.1.9129</p></blockquote>
<p>像上面这句话的意思就是赋予magusv这个view能够查看1.3.6.1.4.1.9129下面所有节点的权限。最后要做的是设定哪些组的人，哪些view的用户可以做什么具体的事情，用access来设置，基本语法是“access NAME CONTEXT MODEL LEVEL PREFX READ WRITE NOTIFY”。</p>
<blockquote><p>access   magusg   “”   any   noauth   exact   magusv   magusv   none</p></blockquote>
<p>由于例子中用的是v2c版本的协议，所以CONTEXT必须为空，MODEL也就是协议的版本号，在这里例子里面可以是any也可以是v2c，还是由于v2c的缘故，所以LEVEL是noauth；READ、WRITE和NOTIFY分别需要指定一个view或者什么都不指定；在这里的设置就是magusv这个view可以对前面设置好的节点进行读和写操作。</p>
<p>到此，服务端的配置已经完成，重启一下snmpd就可以了，下面看看如何通过SNMP得到我们想要的数据</p>
<blockquote><p>snmpwalk -v 2c -c magus localhost 1.3.6.1.4.1.9129.1.2.2</p></blockquote>
<p>snmpwalk可以便利指定节点下的所有子节点，-v 参数指定SNMP的协议版本，这个跟我们之前配置服务器的版本是要一致的，也就是2c，然后-c参数就指定了community的字符串，也就是刚才定义的magus，然后就是主机地址，由于我在本机测试，所以用的localhost，实际中可以填上IP，最后就是OID的值。搞定！</p>
<p>对于刚刚接触SNMP的朋友来说，理解community的作用是关键，其实说的通俗点就是接头暗号，而且还是个明文的“暗号”。</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%2Flinux%2Fsetup-snmpd-conf%2F&amp;title=Linux%E4%B8%8B%E7%9A%84snmpd.conf%E9%85%8D%E7%BD%AE%E8%AF%B4%E6%98%8E&amp;annotation=SNMP%28Simple%20Network%20Management%20Protocol%2C%E7%AE%80%E5%8D%95%E7%BD%91%E7%BB%9C%E7%AE%A1%E7%90%86%E5%8D%8F%E8%AE%AE%29%E7%9A%84%E5%89%8D%E8%BA%AB%E6%98%AF%E7%AE%80%E5%8D%95%E7%BD%91%E5%85%B3%E7%9B%91%E6%8E%A7%E5%8D%8F%E8%AE%AE%28SGMP%29%EF%BC%8C%E7%94%A8%E6%9D%A5%E5%AF%B9%E9%80%9A%E4%BF%A1%E7%BA%BF%E8%B7%AF%E8%BF%9B%E8%A1%8C%E7%AE%A1%E7%90%86%E3%80%82%E5%9C%A8RHEL%E4%B8%AD%EF%BC%8CSNMP%E7%9A%84%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E5%9C%B0%E5%9D%80%E6%98%AF%2Fetc%2Fsnmp%2Fsnmpd.conf%E3%80%82snmpd.conf%E7%9A%84%E9%85%8D%E7%BD%AE%E9%A1%B9%E5%BE%88%E5%A4%9A%EF%BC%8C%E4%BD%86%E6%98%AF%E7%9C%9F" 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%2Flinux%2Fsetup-snmpd-conf%2F&amp;title=Linux%E4%B8%8B%E7%9A%84snmpd.conf%E9%85%8D%E7%BD%AE%E8%AF%B4%E6%98%8E&amp;bodytext=SNMP%28Simple%20Network%20Management%20Protocol%2C%E7%AE%80%E5%8D%95%E7%BD%91%E7%BB%9C%E7%AE%A1%E7%90%86%E5%8D%8F%E8%AE%AE%29%E7%9A%84%E5%89%8D%E8%BA%AB%E6%98%AF%E7%AE%80%E5%8D%95%E7%BD%91%E5%85%B3%E7%9B%91%E6%8E%A7%E5%8D%8F%E8%AE%AE%28SGMP%29%EF%BC%8C%E7%94%A8%E6%9D%A5%E5%AF%B9%E9%80%9A%E4%BF%A1%E7%BA%BF%E8%B7%AF%E8%BF%9B%E8%A1%8C%E7%AE%A1%E7%90%86%E3%80%82%E5%9C%A8RHEL%E4%B8%AD%EF%BC%8CSNMP%E7%9A%84%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E5%9C%B0%E5%9D%80%E6%98%AF%2Fetc%2Fsnmp%2Fsnmpd.conf%E3%80%82snmpd.conf%E7%9A%84%E9%85%8D%E7%BD%AE%E9%A1%B9%E5%BE%88%E5%A4%9A%EF%BC%8C%E4%BD%86%E6%98%AF%E7%9C%9F" 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%2Flinux%2Fsetup-snmpd-conf%2F&amp;title=Linux%E4%B8%8B%E7%9A%84snmpd.conf%E9%85%8D%E7%BD%AE%E8%AF%B4%E6%98%8E&amp;notes=SNMP%28Simple%20Network%20Management%20Protocol%2C%E7%AE%80%E5%8D%95%E7%BD%91%E7%BB%9C%E7%AE%A1%E7%90%86%E5%8D%8F%E8%AE%AE%29%E7%9A%84%E5%89%8D%E8%BA%AB%E6%98%AF%E7%AE%80%E5%8D%95%E7%BD%91%E5%85%B3%E7%9B%91%E6%8E%A7%E5%8D%8F%E8%AE%AE%28SGMP%29%EF%BC%8C%E7%94%A8%E6%9D%A5%E5%AF%B9%E9%80%9A%E4%BF%A1%E7%BA%BF%E8%B7%AF%E8%BF%9B%E8%A1%8C%E7%AE%A1%E7%90%86%E3%80%82%E5%9C%A8RHEL%E4%B8%AD%EF%BC%8CSNMP%E7%9A%84%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E5%9C%B0%E5%9D%80%E6%98%AF%2Fetc%2Fsnmp%2Fsnmpd.conf%E3%80%82snmpd.conf%E7%9A%84%E9%85%8D%E7%BD%AE%E9%A1%B9%E5%BE%88%E5%A4%9A%EF%BC%8C%E4%BD%86%E6%98%AF%E7%9C%9F" 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%2Flinux%2Fsetup-snmpd-conf%2F&amp;t=Linux%E4%B8%8B%E7%9A%84snmpd.conf%E9%85%8D%E7%BD%AE%E8%AF%B4%E6%98%8E" 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%2Flinux%2Fsetup-snmpd-conf%2F&title=Linux%E4%B8%8B%E7%9A%84snmpd.conf%E9%85%8D%E7%BD%AE%E8%AF%B4%E6%98%8E" 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%2Flinux%2Fsetup-snmpd-conf%2F&title=Linux%E4%B8%8B%E7%9A%84snmpd.conf%E9%85%8D%E7%BD%AE%E8%AF%B4%E6%98%8E&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=Linux%E4%B8%8B%E7%9A%84snmpd.conf%E9%85%8D%E7%BD%AE%E8%AF%B4%E6%98%8E&amp;link=http%3A%2F%2Fmagustest.com%2Fblog%2Flinux%2Fsetup-snmpd-conf%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%2Flinux%2Fsetup-snmpd-conf%2F&amp;title=Linux%E4%B8%8B%E7%9A%84snmpd.conf%E9%85%8D%E7%BD%AE%E8%AF%B4%E6%98%8E" 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%2Flinux%2Fsetup-snmpd-conf%2F&amp;title=Linux%E4%B8%8B%E7%9A%84snmpd.conf%E9%85%8D%E7%BD%AE%E8%AF%B4%E6%98%8E&amp;body=SNMP%28Simple%20Network%20Management%20Protocol%2C%E7%AE%80%E5%8D%95%E7%BD%91%E7%BB%9C%E7%AE%A1%E7%90%86%E5%8D%8F%E8%AE%AE%29%E7%9A%84%E5%89%8D%E8%BA%AB%E6%98%AF%E7%AE%80%E5%8D%95%E7%BD%91%E5%85%B3%E7%9B%91%E6%8E%A7%E5%8D%8F%E8%AE%AE%28SGMP%29%EF%BC%8C%E7%94%A8%E6%9D%A5%E5%AF%B9%E9%80%9A%E4%BF%A1%E7%BA%BF%E8%B7%AF%E8%BF%9B%E8%A1%8C%E7%AE%A1%E7%90%86%E3%80%82%E5%9C%A8RHEL%E4%B8%AD%EF%BC%8CSNMP%E7%9A%84%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E5%9C%B0%E5%9D%80%E6%98%AF%2Fetc%2Fsnmp%2Fsnmpd.conf%E3%80%82snmpd.conf%E7%9A%84%E9%85%8D%E7%BD%AE%E9%A1%B9%E5%BE%88%E5%A4%9A%EF%BC%8C%E4%BD%86%E6%98%AF%E7%9C%9F" 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=Linux%E4%B8%8B%E7%9A%84snmpd.conf%E9%85%8D%E7%BD%AE%E8%AF%B4%E6%98%8E&uri=http%3A%2F%2Fmagustest.com%2Fblog%2Flinux%2Fsetup-snmpd-conf%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=Linux%E4%B8%8B%E7%9A%84snmpd.conf%E9%85%8D%E7%BD%AE%E8%AF%B4%E6%98%8E%20-%20http%3A%2F%2Fmagustest.com%2Fblog%2Flinux%2Fsetup-snmpd-conf%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/linux/setup-snmpd-conf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>介绍一个格式化XML文档（自动缩进）的工具</title>
		<link>http://magustest.com/blog/computer/formatting-xml-auto-indent/</link>
		<comments>http://magustest.com/blog/computer/formatting-xml-auto-indent/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 02:27:08 +0000</pubDate>
		<dc:creator>magus</dc:creator>
				<category><![CDATA[计算机技术]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://magustest.com/blog/?p=580</guid>
		<description><![CDATA[有时候会遇到这样的一种情况，我们的数据以XML格式发送HTTP请求到服务器，然后服务器的相应也是XML格式的数据，那么我们看这堆XML数据的时候就会比较费劲，因为这些XML的显示格式是乱的，也就是没有做缩进的。网上有好几种方法可以对XML文档进行缩进输出。现在介绍一个免费的工具：Firstobject&#8217;s free XML editor。该工具用C++编写，短小精悍，格式化XML文档起来也非常快，它可以帮我们格式化XML文档，实现自动缩进，提高工作效率。



Share and Enjoy:


	
	
	
	
	
	
	
	
	
	
	
	
	




No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>有时候会遇到这样的一种情况，我们的数据以XML格式发送HTTP请求到服务器，然后服务器的相应也是XML格式的数据，那么我们看这堆XML数据的时候就会比较费劲，因为这些XML的显示格式是乱的，也就是没有做缩进的。网上有好几种方法可以对XML文档进行缩进输出。现在介绍一个免费的工具：<a href="http://www.firstobject.com/dn_editor.htm" target="_blank">Firstobject&#8217;s free XML editor</a>。该工具用C++编写，短小精悍，格式化XML文档起来也非常快，它可以帮我们格式化XML文档，实现自动缩进，提高工作效率。</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%2Fcomputer%2Fformatting-xml-auto-indent%2F&amp;t=%E4%BB%8B%E7%BB%8D%E4%B8%80%E4%B8%AA%E6%A0%BC%E5%BC%8F%E5%8C%96XML%E6%96%87%E6%A1%A3%EF%BC%88%E8%87%AA%E5%8A%A8%E7%BC%A9%E8%BF%9B%EF%BC%89%E7%9A%84%E5%B7%A5%E5%85%B7" 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%2Fformatting-xml-auto-indent%2F&title=%E4%BB%8B%E7%BB%8D%E4%B8%80%E4%B8%AA%E6%A0%BC%E5%BC%8F%E5%8C%96XML%E6%96%87%E6%A1%A3%EF%BC%88%E8%87%AA%E5%8A%A8%E7%BC%A9%E8%BF%9B%EF%BC%89%E7%9A%84%E5%B7%A5%E5%85%B7" 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%2Fformatting-xml-auto-indent%2F&title=%E4%BB%8B%E7%BB%8D%E4%B8%80%E4%B8%AA%E6%A0%BC%E5%BC%8F%E5%8C%96XML%E6%96%87%E6%A1%A3%EF%BC%88%E8%87%AA%E5%8A%A8%E7%BC%A9%E8%BF%9B%EF%BC%89%E7%9A%84%E5%B7%A5%E5%85%B7&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%8B%E7%BB%8D%E4%B8%80%E4%B8%AA%E6%A0%BC%E5%BC%8F%E5%8C%96XML%E6%96%87%E6%A1%A3%EF%BC%88%E8%87%AA%E5%8A%A8%E7%BC%A9%E8%BF%9B%EF%BC%89%E7%9A%84%E5%B7%A5%E5%85%B7&amp;link=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fformatting-xml-auto-indent%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%2Fformatting-xml-auto-indent%2F&amp;title=%E4%BB%8B%E7%BB%8D%E4%B8%80%E4%B8%AA%E6%A0%BC%E5%BC%8F%E5%8C%96XML%E6%96%87%E6%A1%A3%EF%BC%88%E8%87%AA%E5%8A%A8%E7%BC%A9%E8%BF%9B%EF%BC%89%E7%9A%84%E5%B7%A5%E5%85%B7" 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=%E4%BB%8B%E7%BB%8D%E4%B8%80%E4%B8%AA%E6%A0%BC%E5%BC%8F%E5%8C%96XML%E6%96%87%E6%A1%A3%EF%BC%88%E8%87%AA%E5%8A%A8%E7%BC%A9%E8%BF%9B%EF%BC%89%E7%9A%84%E5%B7%A5%E5%85%B7&uri=http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fformatting-xml-auto-indent%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%8B%E7%BB%8D%E4%B8%80%E4%B8%AA%E6%A0%BC%E5%BC%8F%E5%8C%96XML%E6%96%87%E6%A1%A3%EF%BC%88%E8%87%AA%E5%8A%A8%E7%BC%A9%E8%BF%9B%EF%BC%89%E7%9A%84%E5%B7%A5%E5%85%B7%20-%20http%3A%2F%2Fmagustest.com%2Fblog%2Fcomputer%2Fformatting-xml-auto-indent%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/formatting-xml-auto-indent/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
