Resources for TDD aimed at Python Web Development [closed]

喜你入骨 提交于 2019-12-03 01:32:51

问题


I am a hacker not and not a full-time programmer but am looking to start my own full application development experiment. I apologize if I am missing something easy here. I am looking for recommendations for books, articles, sites, etc for learning more about test driven development specifically compatible with or aimed at Python web application programming. I understand that Python has built-in tools to assist. What would be the best way to learn about these outside of RTFM? I have searched on StackOverflow and found the Kent Beck's and David Astels book on the subject. I have also bookmarked the Wikipedia article as it has many of these types of resources.

Are there any particular ones you would recommend for this language/application?


回答1:


I wrote a series of blogs on TDD in Django that covers some TDD with the nose testing framework.

There are a lot of free online resources out there for learning about TDD:

  • The c2 wiki article gives good background on general TDD philosophy.
  • The onlamp article is a simple introduction.
  • Here's a presentation on TDD with game development in pygame that really helped me understand TDD.

For testing web applications, test first or otherwise, I'd recommend twill and selenium as tools to use.




回答2:


Can I plug my own tutorial, which covers the materials from the official Django tutorial, but uses full TDD all the way - including "proper" functional/acceptance tests using the Selenium browser-automation tool... http://tdd-django-tutorial.com

[update 2014-01] I now have a book, just about to be published by OReilly, that covers all the stuff from the tutorial and much more. The full thing is available online (free) at http://www.obeythetestinggoat.com




回答3:


I know that Kent Beck's book (which you mentioned) covers TDD in Python to some pretty good depth. If I remember correctly, the last half of the book takes you through development of a unit test framework in Python. There's nothing specific to web development, though, which is a problem in many TDD resources that I've read. It's a best practice to keep your business logic separate from your presentation in order to make your BL more testable, among other reasons.

Another good book that you might want to look into is xUnit Test Patterns. It doesn't use Python, but it does talk a lot about designing for testability, how to use mocks and stubs (which you'll need for testing web applications), and automating testing. It's more advanced than Beck's book, which makes it a good follow-up.




回答4:


I'd recommend "xUnit Test Patterns: Refactoring Test Code" by Gerard Meszaros. It is not Python or Web specific, but it's a good book on TDD in general and the xUnit framework in particular. Since python unittest is actually an xUnit implementation ("a Python version of JUnit", as the docs say), I'd say that the book is very useful for Python unit testers.

It has an online version at xunitpatterns.com.




回答5:


Here is a great series of article written on test driven development in python. It starts from basic and goes to a point, where you are taught stuffs as designing for maintainability etc. I am sure you would like it.




回答6:


A very good unit test framework is also trial from the twisted project.




回答7:


A little late to the game with this one, but I have been hunting for a Python oriented TDD book, and I just found Python Testing: Beginner's Guide by Daniel Arbuckle. Haven't had a chance to read it yet, but when I do, I'll try to remember to post a follow up here. The reviews on the Amazon page look pretty positive though.



来源:https://stackoverflow.com/questions/476668/resources-for-tdd-aimed-at-python-web-development

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!