News for hackers. Stuff that matters.
Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by ams6110 on Sunday November 10, 2013 @04:18PM (#6708486)
This is a bit of a tangent, but having seen TDD fail more often than not ("fail" meaning it just seems like writing tests is busywork for no real benefit, and eventually as the deadline looms devs just stop writing tests) I'm wondering if there's an approach where the tests are NOT written by the person writing the code... e.g. a senior lead or QA person of some sort writes the tests, which become attached to the stories that the devs implement.
Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by jsankey on Sunday November 10, 2013 @04:36PM (#6708555)
Wouldn't that mean you lose one of the reputed benefits of TDD: writing tests as a way of exploring the problem space, informing the design of the code under test? More generally while there is a place for testers that are at arm's length from the implementation, giving the implementor some of the testing responsibility (TDD or otherwise) has the benefit of investing the implementor directly in the QA process.
Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by edwinnathaniel on Sunday November 10, 2013 @04:37PM (#6708556)
Dev should write unit tests and integration tests (some go even further to write functional tests using selenium).

Asking QA to write unit tests falls into the category of busywork with extra overhead which a sure recipe of not being agile.

You could ask them to write functional tests but not any lower than that.

I do not do TDD but I always make sure my commits should have unit tests whenever possible because I do not commit without testing them first :)

Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by vinceguidry on Monday November 11, 2013 @05:55PM (#6714692)
You really shouldn't do it that way. Tests should be written by the guy that wrote the code, while the problem the code solves is still fresh in mind. If you don't, then you'll have to re-understand both the code and the problem it solves before you'll be able to write good tests for it. That means TDD.

You TDD because the code you write with it is code that is easily tested. If you write the tests after you write the code, then you'll have to refactor the code just to get it to the point where its testable without digging really deep into your classes. It will be painful, and the effort will be abandoned.

I thought I wrote good, clean code. Then I started unit testing. Now I wouldn't think of writing code first. The procedural mess that my brain comes up with inevitably results in hard to refactor, hard to test spaghetti.

Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by brandonbloom on Sunday November 10, 2013 @05:05PM (#6708658)
The word "driven" like the word "oriented" are the problem. Once you make it a religion, or otherwise elevate any one idea above all else, you suck away most of the value from it and preclude yourself from deriving value from competing ideas.
Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by alaskamiller on Sunday November 10, 2013 @03:07PM (#6708191)
If you liked this article and want to learn more then join us at https://flask.reddit.com, a 1500+ strong Python/Flask development.

/shamelessplug

Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by recuter on Sunday November 10, 2013 @07:01PM (#6709102)
TIL subdomains redirect to subreddits. Neat.
Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by hmsimha on Monday November 11, 2013 @11:32AM (#6712380)
even more interestingly, since alaskamiller linked it with the https protocol, it just redirects to http since reddit doesn't use ssl except for login, but if you try visiting https://reddit.com/r/flask you (at least in chrome) get a browser warning.
Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by frakkingcylons on Sunday November 10, 2013 @03:21PM (#6708249)
Looks really useful. I've made a few small Flask apps (mostly for interacting with Twilio and Reddit). However, as I've been working on a larger one I've had a lot of hesitation on how to structure and test it properly.

On that note, can anyone refer to me some helpful texts on this matter (designing larger Flask applications), beyond the official docs and Miguel Grinberg's tutorial?

Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by superchan on Sunday November 10, 2013 @03:48PM (#6708372)
Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by frakkingcylons on Sunday November 10, 2013 @04:56PM (#6708618)
Thank you!
Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by theintern on Sunday November 10, 2013 @03:53PM (#6708391)
I'd also like to read something like this. Grinberg is working on a book on flask, so it should be worth a read when it comes out in 2014.
Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by leetrout on Sunday November 10, 2013 @04:41PM (#6708566)
Side note- would love to see more tutorials with virtualenv to also include virtualenvwrapper. Makes virtualenv so much more user friendly IMO.
Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by LukeWalsh on Sunday November 10, 2013 @03:02PM (#6708169)
This is truly excellent. A lot of articles and 'tutorials' about this topic are little more than a melting pot of buzzwords.

The best way to explain test driven development is through examples, and I think this tutorial does it wonderfully.

I will be sharing this generously.

Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by carrollgt91 on Sunday November 10, 2013 @03:47PM (#6708365)
Definitely going to run through this soon.

I love seeing how others approach TDD, it's one of those topics that can be handled in so many different ways and seeing how others tackle it is so informative, even if you've been doing it for awhile.

Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by speg on Sunday November 10, 2013 @05:22PM (#6708726)
Now you need to add some tests for the front-end too.
Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by e12e on Sunday November 10, 2013 @08:18PM (#6709392)
I've yet to read the entire thing, but one of the things that I liked about:

"Test-Driven Development with Python" (uses Django, is free to read online) http://chimera.labs.oreilly.com/books/1234000000754

is that it starts out with:

   from selenium import webdriver

   browser = webdriver.Firefox()
   browser.get('http://localhost:8000')

   assert 'Django' in browser.title
before any other thing.
Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by grumps on Sunday November 10, 2013 @07:01PM (#6709103)
I've been wanting to give Flask a trial. This just wraps this up in goodness that I'd also like to try :-)

Thanks for posting.

Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by j1z0 on Sunday November 10, 2013 @09:14PM (#6709549)
Flask is awesome. Tdd is awesome and this tutorial is awesome! Thanks for sharing.
Re:Flaskr: Intro to Flask, Test-Driven Development, and jQuery by mjhea0 on Sunday November 10, 2013 @04:24PM (#6708504)
check out http://realpython.com for more tdd