9 ms·
Does anybody have recommendations for where/how to start learning best practices for TDD? As (nominally) top nerd at a tiny startup (2 engineers), I feel like
by elsbree 13y ago
Does anybody have recommendations for where/how to start learning best practices for TDD?
As (nominally) top nerd at a tiny startup (2 engineers), I feel like I should set a precedent sooner rather than later for testing. This is currently not possible since I don't know anything about it, so any resources would be appreciated :)
Edit: Primarily looking for resources involving Node.js and client-side testing of a jQuery-based website.
- hoka 13y agoIf you're a python developer, http://www.tdd-django-tutorial.com/ http://www.tdd-django-tutorial.com/ is an excellent resource.
- elsbree 13y agoThanks! Our backend is built on Node, but I'll see if I can glean some general concepts from this.
- jcagalawan 13y agoI found http://www.letscodejavascript.com/ http://www.letscodejavascript.com/ very useful.
- elsbree 13y agoWow, looks really helpful. I'm definitely going to try out their trial. Thanks!
- 2mur 13y agoFor node + browser, I'm partial to substack's tape module[1][2] to output tap. Works great with browserify too. [1] https://github.com/substack/tape https://github.com/substack/tape [2] http://www.catonmat.net/blog/writing-javascript-tests-with-tape/ http://www.catonmat.net/blog/writing-javascript-tests-with-t...
- elsbree 13y agoThis looks awesome, thanks! Definitely what I was looking for.
- warfangle 13y agoI've been setting up client side testing with grunt+browserify+karma+jasmine lately. It's pretty freaking powerful. But, none of the usual suspects for mocking http.get requests work well with it (sinon fails to execute in a browserify test environment; nock expects to be running in a node environment with the ClientRequest object available).
- ulisesrmzroche 13y agowhy is sinon failing to execute in browserify? It's supposed to be stand-alone. Is it being included correctly?
- warfangle 13y agohttps://github.com/cjohansen/Sinon.JS/pull/358 https://github.com/cjohansen/Sinon.JS/pull/358 Longer story: using npm to install sinon; shimming sinon in my karma browserify plugin config (`'sinon' : 'global:sinon'`)since it doesn't follow CommonJS; using browserify (and the karma browserify plugin) to require('sinon'); sinon is undefined after var sinon = require('sinon'). Might be something up with my config, but none of the other non-commonjs modules I shim (jquery, swfobject) have the same issues.
- mseebach 13y agoTDD isn't a tool or a library, and thus isn't specific to a language or a framework - it's a philosophy. Get, read and understand Kent Beck: "Test driven development by example". The rest will follow naturally.
- ulisesrmzroche 13y agoWhen writing tests, the key to remember is to write what you wish you had. Othe than that, are you on Express.js? Also, have you ever tried QUnit?
- elsbree 13y agoYes, we're using Express.js. QUnit looks interesting, I think I'll start with it. Is it pretty standard to just have an HTML file that runs all your client-side tests?
- davidjnelson 13y agoI'd recommend using grunt and karma and avoiding having to list all the files you want to test in an html file.
- davidjnelson 13y agoGrowing Object Oriented Software Guided By Tests is a great book on the topic: http://www.amazon.com/Growing-Object-Oriented-Software-Guided-Tests/dp/0321503627 http://www.amazon.com/Growing-Object-Oriented-Software-Guide... Misko Hevery's (also happens to be creator of angularjs!) Testability Explorer blog is also a great resource: http://misko.hevery.com/category/testability-explorer/ http://misko.hevery.com/category/testability-explorer/
- csgavino1 13y agoUncle Bob's videos on TDD are pretty neat cleancoders.com .
- jimejim 13y agoAlong with what everyone else mentioned, if you like podcasts, this one gave me some good insights along with the blog: http://www.sustainabletdd.com/ http://www.sustainabletdd.com/ One aha moment for me that's talked about here is to treat your tests more as a form of documentation and specification of how to use the system. They talk about how you should even do some basic tests to confirm enumerations and constants in the system as a way to be clear about their use. You don't always have to be as thorough, but the mental shift from test to specification was helpful for me. Edit: Unfortunately, if you download this podcast it's a bit out of order, so you want to read the blog and use it as a guide for which order to listen to things. They're in the process of writing a book about TDD and this blog is part of their process.