I think when people say "unit" tests to mean fully isolated tests, what
they really mean is *whitebox* tests. You define the size of the unit under
test and context runs from full isolation (whitebox test) to full
integration/user-experience (blackbox test)
--
Steven


On Fri, Sep 7, 2012 at 7:39 AM, Harry P <harry.perci...@gmail.com> wrote:

> Hey, glad to hear someone's been found it useful!
>
> re: whether my unit tests are unit tests or not... some people have a very
> restrictive definition of what a unit test is - they want it to be 100%
> isolated from other tests, always mock out the filesystem and the database,
> etc.  That's fine, but we tend to find it's a bit OTT, and a slightly more
> relaxed approach is more productive.   Ultimately, I'm writing two types of
> test - some high-level tests that test the behaviour of the app from the
> user's point of view - so call them system tests, or functional tests, or
> acceptance tests, or whatever you will, but their purpose is to check the
> system actually works.  The other type of test is low-level, they test the
> behaviour of individual functions, classes etc, and their purpose is to
> help you think about your code before you write it, to think through edge
> cases and to help write correct code.
>
> So, to me, the important thing is that you have those two types of test,
> and that they help you achieve those two different objectives.  Finer
> details of terminology or practices to do with mocking, stubbing etc are up
> to personal preferences really.
>
> cheers,
> hp
>
>
>
>
> On Friday, September 7, 2012 10:25:32 AM UTC+1, jyria wrote:
>>
>> Thank you for reply,
>>
>> I have been using your tutorial to learn TDD in django. One of the best I
>> have found so far. You also talk about "unit tests" and thats what is
>> confusing. As I understand, your tutorial examples are not unit tests in
>> the strict meaning of the term.
>>
>> You have a great tutorial and I have learned a lot of them. Maybe too
>> much focus on admin and polls app for me. I would have liked to see
>> something different and new. What about running you selenium functional
>> tests in a acceptance testing framework?
>>
>> I would love to see your tutorials for intermediate/advanced level.
>>
>> On Thursday, September 6, 2012 1:57:08 PM UTC+3, Harry P wrote:
>>>
>>> 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/<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 <jyr...@gmail.com> 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<http://www.methodsandtools.com/archive/attready3.jpg>
>>>>
>>>> >
>>>> > https://www.google.com/webhp?**q=tdd%20is%20not%20unit%**20testing<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/-/bd66gSnGKhkJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to