Hi there, I work for a bunch of XP fanatics, so we do quite religious TDD in our Python/Django development. We start with functional/acceptance tests, which we write using Selenium, driving a real web browser, and following a test script that is essential a user story. We then write unit tests that we can run using a python manage.py test.
I've written a "TDD for beginners" tutorial, that covers both of these types of test: http://www.tdd-django-tutorial.com/ I'd love any comments, feedback, suggestions? rgds, Harry On Thursday, September 6, 2012 1:47:08 AM UTC+1, Mike Dewhirst wrote: > > On 6/09/2012 3:04am, Javier Guerra Giraldez wrote: > > On Wed, Sep 5, 2012 at 7:46 AM, jyria <[email protected] <javascript:>> > wrote: > >> What is your experience? Is it worth it, and is it possible? > >> > >> I tried it and found it quite difficult to follow guideline of unit > testing > >> -- testing a unit of code, a class for example. Maybe Im just ignorant, > but > >> I didnt see, how can I create registration app only with unit tests. > The > >> only way I could drive implementation with tests was using more like an > >> integration testing approach: calling requests with data and asserting > that > >> new user was registered and that form was valid/invalid etc, but this > goes > >> against TDD as I understand it. So should I not worry about pure "unit > >> testing" approach and use django client http request to validate > >> RegistrationForm. Or I should write unit tests for RegistrationForm > class? > > > > TDD is not unit-testing > > Here is a lovely diagram I found recently - probably by following a link > someone posted here - which shows the TDD process with unit tests and > acceptance tests. > > IMO it covers pretty much everything in the universe ... > > http://www.methodsandtools.com/archive/attready3.jpg > > > > > https://www.google.com/webhp?q=tdd%20is%20not%20unit%20testing > > > > > > in short, it's like you've found: the tests you easily get with TDD > > are more (but not exactly) like integration tests, because you test > > features, not units. The "test isolated units" mantra of unit-testing > > requires different work. There's nothing wrong in adding 'real' > > unit-tests, but it's not required to do effective TDD. > > > > I guess that since unittesting became so well known so long ago, > > almost all test frameworks (including Python's and Django's) call > > their base test class "UnitTest", but they're not; they're just tests. > > you make them feature tests, or integration tests, or unit tests, or > > whatever kind of test. > > > > now, about the pros/cons of unit-testing vs. other kinds of tests..... > > that's a whole debate that i'm not going to touch. > > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/zN3GT06MfH4J. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

