learning unit testing in python

A

Alex

Hi all.

I'd like learn some basic unit testing with python.
I red some articles about different testing framework like unittest or
nose, but I'm a bit confused: what is the best choice? I'm not a
professional developer (I'm a SEO) but I belive that unit testing is a
good and pragmatic way to produce working software, so I'd like to
find something really simple ad straightforward because I don't have
to manage big programming projects.

Thanks in advance,

Alex
 
J

Josip

Hi all.
I'd like learn some basic unit testing with python.
I red some articles about different testing framework like unittest or
nose, but I'm a bit confused: what is the best choice? I'm not a
professional developer (I'm a SEO) but I belive that unit testing is a
good and pragmatic way to produce working software, so I'd like to
find something really simple ad straightforward because I don't have
to manage big programming projects.

Thanks in advance,

Alex

Have you checked out doctest?
http://docs.python.org/lib/module-doctest.html
It's the best way to add few tests to function or class, you just add
them to docstring.
Unit tests are somewhat demanding as they usualy require creating another
file just for storing them, but are ofcourse more powerful as well. For
example,
unittest module alows you to execute a section of code before or after each
test
to initialize values and clean up.

Nose module has few extra features, but it can also run test writen for
unittest,
so it's easy to switch if you find standard library module lacking for your
purpose.
 
A

Alex

Have you checked out doctest?http://docs.python.org/lib/module-doctest.html
It's the best way to add few tests to function or class, you just add
them to docstring.
Unit tests are somewhat demanding as they usualy require creating another
file just for storing them, but are ofcourse more powerful as well. For
example,
unittest module alows you to execute a section of code before or after each
test
to initialize values and clean up.

Nose module has few extra features, but it can also run test writen for
unittest,
so it's easy to switch if you find standard library module lacking for your
purpose.

Tanks a lot. I'll the resources you suggest..
 
B

BJörn Lindqvist

Hi all.

I'd like learn some basic unit testing with python.
I red some articles about different testing framework like unittest or
nose, but I'm a bit confused: what is the best choice? I'm not a
professional developer (I'm a SEO) but I belive that unit testing is a

The best framework is nose at
http://www.somethingaboutorange.com/mrl/projects/nose/. If you aren't
already familiar with unit testing then http://diveintopython.org has
a good tutorial about it at
http://diveintopython.org/unit_testing/index.html.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top