Let’s Code: Test-Driven JavaScript

James Shore presents a fascinating screencast
on rigorous, professional JavaScript development

Watch Now

Latest Live Episodes

  1. Webfont Smoke Test Redux

    Mon, 31 Aug

    Our 404 page uses Typekit, which loads a webfont via a small script embedded in the page. We want to update our smoke tests to ensure that the font loads properly. Fortunately, we’ve done that before, and with one small refactoring, our font test code works with any URL. Next, we improve our cache-busting build script to handle multiple files.

  2. The ‘Content-Type’ Header

    Wed, 26 Aug

    Our 404 page has a little glitch where we use a curly quote. Instead of displaying a ’ character, it displays ’. It’s a classic character set error and we can fix it by setting the Content-Type header in our server code. We diagnose the problem, write a test to reproduce it, and fix it. Easy peasy.

  3. Totally Stylish

    Mon, 24 Aug

    We finally finish styling our 404 page! We resolve the last of our vertical layout challenges and finish off our tests. We wrap up the chapter with a reflection on our test-driven CSS experiences so far.

Latest Specials

  1. Cross-Browser Tests

    Fri, 28 Aug

    We’ve set up our automated tests, but they’re running in Node.js, not real browsers. That’s a problem because Node and browsers aren’t totally compatible. We need to test our code in our actual supported browsers to be certain it works. We look at the options and demonstrate how to get Karma up and running.

  2. Test Frameworks

    Fri, 21 Aug

    We continue our look at test automation by investigating test frameworks. We demonstrate the how and why of Mocha, a popular JavaScript test framework. We also discuss the differences between TDD (test-driven development) and BDD (behavior-driven development) and how those differences affect your choice of testing tools.

  3. Assertions

    Fri, 14 Aug

    We start our look at test automation with the first of three fundamental testing tools: assertions. We start from first principles by building our own assertion function, then introduce the popular Chai assertion library. Along the way, we touch on exception handling and take a look at the pros and cons of different assertion styles.

An in-depth screencast about
Test-Driven JavaScript

You've taught me a lot this past year and have
been better than a teacher, a true mentor.
Jason Weden
I’m completely new to TDD and this is by far
the most comprehensive TDD for JS... your videos are
a breath of fresh air!
Adam Brodzinski
This is a gold mine... This will help a lot in my day job.
Timothy Myers
Love what you're doing. It's helped out our
team tremendously here at Sevenly.
Scott Corgan
I’m delighted with LCJ. It’s interesting and informative, and the
candid way you think aloud makes it personal and engaging.
You’ve done a terrific job.
Crispin Bennett

JavaScript Needs Test-Driven Development

If you’ve programmed in JavaScript, you know that it’s an… interesting… language. Don’t get me wrong: I love JavaScript. I love its first-class functions, the intensive VM competition among browser makers, and how it makes the web come alive. It definitely has its good parts.

It also has some not-so-good parts. Whether it’s browser DOMs, automatic semicolon insertion, or an object model with a split personality, everyone’s had some part of JavaScript bite them in the butt at some point. That’s why using test-driven development is so important.

What is Test-Driven Development?

Test-driven development (TDD) is a technique for ensuring that your code does what you think it does. It’s particularly relevant for JavaScript, with its cross-browser incompatibilities and hidden gotchas. With TDD, you express your intentions twice: once as a test, and once as production code. If the two approaches don’t match, your tests fail, and you’ve caught a bug.

TDD is a great way of catching the majority of programming errors. It’s not perfect, of course—in particular, it can’t tell you when your assumptions are wrong—but it’s very good at catching the kinds of bugs JavaScript is prone to.

Who am I?

I’m James Shore. I’ve been building applications using test-driven development and other Agile techniques for over 15 years. I’m a recipient of the Agile Alliance’s Gordon Pask Award for Contributions to Agile Practice and I wrote a book called The Art of Agile Development.

What You Get

This screencast series focuses on rigorous, professional web development. That means test-driven development, of course, and also techniques such as build automation, continuous integration, refactoring, and evolutionary design. We test against multiple browsers and platforms, including iOS, and we use Node.js on the server.

All videos are DRM-free, available for streaming or download, and all source code is included.

The Videos

The series consists of four main channels. The “Recorded Live” channel focuses on real-world development, warts and all. It’s meant for experienced programmers.

If you’re a new developer, the “How To” channel is for you. It’s meant for beginners who have recently learned to program and are ready to start their professional career.

The “Lessons Learned” channel provides concise reviews of key topics, such as continuous integration, test-driven development, and build automation. It’s great for review and reference.

Advanced programmers will enjoy “The Lab”, our channel focused on exploring new tools and ideas.

Release Schedule

New videos are published every week. At the time of this writing, a new “Recorded Live” episode is released every Monday and Wednesday, and a new “How To” episode is released every Friday.

When the current “How To” season finishes, we will probably return releasing a new “Lessons Learned” or “The Lab” episode on the first Friday of every month.

“Recorded Live” and “How To” episodes are about 15 minutes long. “Lessons Learned” videos are typically about 15-30 minutes long, and episodes of “The Lab” tend to be about an hour.

I have learned so much more than I expected.
I really enjoy your approach to screencasting and
wish the series wouldn’t end some day.