aspose file tools*
The moose likes Jython/Python and the fly likes Testing in Python Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Languages » Jython/Python
Bookmark "Testing in Python" Watch "Testing in Python" New topic
Author

Testing in Python

David DeCesare
Greenhorn

Joined: May 25, 2001
Posts: 13
Coming from the Java world, I've grown used to having solid testing frameworks such as JUnit and TestNG. Does Python have similar testing frameworks? I just starting taking a Python course at Coursera and I didn't see any mentions of testing frameworks in that class. I'm starting to learn Python to help with scripting Linux deployments. Another popular language for that work is Ruby which has a very strong testing background.

Thank you,
David
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3969
    
  17

Python has a unittest module: http://docs.python.org/library/unittest.html


Steve
David DeCesare
Greenhorn

Joined: May 25, 2001
Posts: 13
Thanks Steve! Reading through that site, it looks very similar to the Java testing tools (which is great). Just out of curiosity, based on your experience is testing in Python viewed as important as it is in the Ruby community? I apologize for the newbie questions but I just started with Python :-).

Thanks again,
Dave
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3969
    
  17

My experience is probably not the best in this case. I use Python as a scripting add-in to another application. Scripts tend to be short and targeted, and not well tested (but really not have many failure points either). I have used the unittest module a bit but I think of those I work with I am in the minority.

If you are writing a large project or stand-alone application then I think the need to unit test your application is the same as any other language.
Palak Mathur
Ranch Hand

Joined: Jan 29, 2007
Posts: 313

You can try PyUnit (http://pyunit.sourceforge.net).


Palak Mathur | My Blog | TechJaunt | What is JavaRanch? | List of All FAQs
Allen Downey
Author
Greenhorn

Joined: Sep 07, 2012
Posts: 25

I use PyUnit and I think it is very good, but I have to admit that testing and test-driven design might not be as ingrained in the Python programmer culture as it is in others.

But as Python is applied to bigger projects, and used in environments with better software engineering practices, I would expect that to change (maybe it already is).

Allen

All of my books are available from http://greenteapress.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Testing in Python
 
Similar Threads
Struts2 testing frameworks? Are there any?
When should you use Python in the Real World?
JEE vs. other Application Frameworks
Is Python better than Java?
Help!!