Saturday, March 12, 2022

Re: How Important Is Writing Unit Tests For Django Applications?

On 13/03/2022 5:00 am, Daniel Coker wrote:
> I understand the importance of unit testing. However, if we are going
> to write integration tests (testing the views), this test will step
> through all of the modules that we would otherwise unit test.
>
> So, I'm wondering, it it really necessary to write unit test for
> Django Applications when we will still test the views?

1.    If you don't unit test your bits and pieces AND you call them in
your views they might pass with wrong values. Subtle errors can creep in
if your views are tested too coarsely.

2.    The more fine-grained the unit tests the easier it is to refactor
your view code.

3.    Do you use Coverage? You will see all the Django code is tested.
Only your own code to test

I do integration testing at a high level as well as down low. Really
does wonders for refactoring confidence.

YMMV

Mike

> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d0cf2d7c-79cb-41a5-801a-4240c3c0c1c1n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d0cf2d7c-79cb-41a5-801a-4240c3c0c1c1n%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d076ee0f-6b30-408d-9bd8-df83a0deb893%40dewhirst.com.au.

No comments:

Post a Comment