The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Django Testing Framework == Fail

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Kurt Schrader

Posts: 80
Nickname: kschrader
Registered: Feb, 2008

Kurt Schrader is an entrepreneur and a ruby programmer.
Django Testing Framework == Fail Posted: Jun 28, 2008 12:36 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Kurt Schrader.
Original Post: Django Testing Framework == Fail
Feed Title: Schrade.Blog
Feed URL: http://kurt.karmalab.org/atom.xml
Feed Description: Tech and Business Ramblings by Kurt Schrader
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Kurt Schrader
Latest Posts From Schrade.Blog

Advertisement

I was reading on a plane recently, and was about halfway through the Django book, when I realized that I hadn't seen anything about how to test my application yet. I tend to be a test first developer and use lots of mocks to play with things, especially at the beginning of a project, so I flipped to the index, turned to the test page, and saw the following:

Testing was still under development when this book was being written, so to learn more you’ll need to read the documentation online at http://www.djangoproject.com/documentation/0.96/testing/

Not a whole lot of help when you're on a plane.

Still, I was willing to give them the benefit of the doubt. Maybe they could create a bolt-on testing framework that would really be something.

Unfortunately, it's just not very good.

Perhaps I'm spoiled by Rails and Rspec, but to me, the Django testing framework feels like something that they put in place just because someone told them that they needed a testing framework. It's not an integral part of the system.

Let's look at their test types.

First of all we have doctests. These emulate the output of the Python interactive interpreter exactly inside of your test code. All this does is to encourage the bad practice of writing some code, firing up your your interpreter, running a few cases, and then cutting and pasting the results into a file. There's no need to think through all of the cases or what you're really doing here. It's just an after the fact, feel-good, safety check.

Second, we have Unit tests. Not the most sophisticated testing framework in the world, but these look like a better choice, very much like any sort of xUnit tests.

The biggest problem I have with these, and the Django testing framework in general, is that the tests don't look to be compulsory. Why, in this day and age, don't we make the generation of a test automatic, and make the user decide to remove it if they really, really don't want to test, not the other way around?

Testing as an afterthought inevitably leads to poorly tested code.

I certainly hope that, as Django continues to grow and mature, testing take a more central role in the future.

Read: Django Testing Framework == Fail

Topic: New support for Rails 2.1 Previous Topic   Next Topic Topic: The Simplest Thing That Could Possibly Work

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use