单元测试 [英] unit testing

查看:115
本文介绍了单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

还有其他人觉得单元测试工作太多了吗?不是一般的,

只是中小型项目的官方单元测试模块?


编写一些在需要时使用的快速方法似乎更容易br />
而不是构建具有集成单元测试的程序。我看到它的

值(正式的单位测试)...特别是当有很多源代码的时候。但是......


如果len(x)!= y:

sys.exit(''...'')


是一个更容易和更快的地狱,在小项目中继承unittest.TestCase

:)


别人做了吗他们自己的非正式单元测试?


好​​奇,


布拉德

解决方案

< blockquote> 2007年10月4日,brad< by ******* @ gmail.comwrote:


是否有其他人认为单元测试太多了工作?不是一般的,

只是中小型项目的官方单元测试模块?


编写一些在需要时使用的快速方法似乎更容易br />
而不是构建具有集成单元测试的程序。我看到它的

值(正式的单位测试)...特别是当有很多源代码的时候。但是......


如果len(x)!= y:

sys.exit(''...'')


是一个更容易和更快的地狱,在小项目中继承unittest.TestCase

:)


别人做了吗他们自己的非正式单元测试?



Doctest通常作为替代那些感觉这种方式的人。就个人而言,我发现任何值得测试的东西都值得拥有一个

测试目录和独立的单元测试。


10月4日,1:02 pm,brad< byte8b ... @ gmail.comwrote:


是否还有其他人认为单元测试工作太多了?不是一般的,

只是中小型项目的官方单元测试模块?


编写一些在需要时使用的快速方法似乎更容易br />
而不是构建具有集成单元测试的程序。我看到它的

值(正式的单位测试)...特别是当有很多源代码的时候。但是......


如果len(x)!= y:

sys.exit(''...'')


是一个更容易和更快的地狱,在小项目中继承unittest.TestCase

:)


别人做了吗他们自己的非正式单元测试?


好​​奇,


布拉德



我其实在做什么很多单元测试。我发现它既烦人又非常有用且非常有用。在通过良好的单元测试离开我的立方体之前,我无法告诉你有多少虫子已被压扁了。我也同意
同意这可能是一个真正的痛苦。我的意见是你应该做TDD

(测试驱动开发)并尽可能多地做到这一点。从长远来看,它确实会节省你的时间和麻烦。


brad< by ****** *@gmail.comwrites:


是否还有其他人认为单元测试工作太多了?不是

一般,只是中小型

项目的官方单元测试模块?



是的,unittest是一种Java主义。您可以尝试使用较新的doctest

模块。


Does anyone else feel that unittesting is too much work? Not in general,
just the official unittest module for small to medium sized projects?

It seems easier to write some quick methods that are used when needed
rather than building a program with integrated unittesting. I see the
value of it (the official unittest that is)... especially when there''s a
lot of source code. But this...

if len(x) != y:
sys.exit(''...'')

is a hell of a lot easier and quicker that subclassing unittest.TestCase
on small projects :)

Do others do their own "informal" unit testing?

Just curious,

Brad

解决方案

On 10/4/07, brad <by*******@gmail.comwrote:

Does anyone else feel that unittesting is too much work? Not in general,
just the official unittest module for small to medium sized projects?

It seems easier to write some quick methods that are used when needed
rather than building a program with integrated unittesting. I see the
value of it (the official unittest that is)... especially when there''s a
lot of source code. But this...

if len(x) != y:
sys.exit(''...'')

is a hell of a lot easier and quicker that subclassing unittest.TestCase
on small projects :)

Do others do their own "informal" unit testing?


Doctest is commonly given as the alternative to people who feel this
way. Personally, I find that anything worth testing is worth having a
test directory and independent unit tests for.


On Oct 4, 1:02 pm, brad <byte8b...@gmail.comwrote:

Does anyone else feel that unittesting is too much work? Not in general,
just the official unittest module for small to medium sized projects?

It seems easier to write some quick methods that are used when needed
rather than building a program with integrated unittesting. I see the
value of it (the official unittest that is)... especially when there''s a
lot of source code. But this...

if len(x) != y:
sys.exit(''...'')

is a hell of a lot easier and quicker that subclassing unittest.TestCase
on small projects :)

Do others do their own "informal" unit testing?

Just curious,

Brad

I actually do a lot of unit testing. I find it both annoying and
highly necessary and useful. I can''t tell you how many bugs have been
squashed before ever leaving my cube by good unit testing. I also
agree that it can be a real pain. My opinion is you should do TDD
(test-driven development) and do it as much as you can tolerate. It
really will save you time and hassle in the long run.


brad <by*******@gmail.comwrites:

Does anyone else feel that unittesting is too much work? Not in
general, just the official unittest module for small to medium sized
projects?

Yeah, unittest is sort of a Java-ism. You might try the newer doctest
module instead.


这篇关于单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆