Making JavaScript Tests Fast, Easy, & Friendly

@ryan_roemer

A few weeks ago, I presented a talk on “Making JavaScript Tests Fast, Easy, & Friendly” at the CascasdiaJS 2014 conference in Portland, OR.

The talk looks beyond the traditional technical details of wiring up test frameworks and focuses on creating processes and environments that help developers actually write and run application tests.

Making the Tests Faster, Easier, Friendlier

The motivation for the talk comes from our work with developer teams of various sizes at Formidable Labs, where we have observed the challenges, successes, and failures of test development as a part of the overall development workflow.

Essentially, these experiences can be culled down to the following:

  • If tests aren’t easy to write, then developers won’t write them.
  • If tests aren’t fast to run, then developers won’t run them.
  • If the organizational culture isn’t test-friendly, then developers won’t
    write or run the tests (and they’ll probably be unhappy to boot).

The talk dives into some tips and tricks to address these three broad goals as follows:

  • Easy
    1. Set a Foundation: Build an infrastructure everyone can use.
    2. Lower Barriers to Entry: Help new developers get acclimated with
      code and mentorship.
    3. Write it Down: Document everything test-related and keep things
      up-to-date.
    4. Teach & Learn: Provide onboarding and small, introductory
      test assignments.
  • Fast
    1. Know What to Look For: Focus on the application behaviors most
      likely to be slowing down your tests (e.g., network and waits).
    2. Find the Slow Pokes: Use your test tools to identify what is slow during tests.
    3. Fake It: Programmatically “fake” the parts of your application that are slow during the tests.
    4. Offer Shortcuts: Provide developers with subsets of tests to run
      when the whole thing is too slow to regularly run.
  • Friendly
    1. Find Champions: Encourage and promote developers who are considered
      project-wide testing leads.
    2. Win the Higher-Ups Over: Learn to speak your managers’ language to get top-down support in your organization for developer time spent writing and running tests.

These are just some of the tips that we’ve found useful for making testing better in our client projects at Formidable Labs. But, there are surely other good techniques for building a strong culture of testing in other organizations. (And, we’d love to hear your experiences!)

Media

The full video of my talk is available from YouTube.
As an aside, the CascadiaJS YouTube Channel has videos from the other (fantastic) talks at this year’s conference.

For those just looking for the slides, you can try the presentation website (with live executable code samples!) or the more traditional SlideShare site, where the final PDF resides.


We Are Formidable

Formidable is a Seattle-based consultancy and open source shop, with an emphasis on Node.js and React.js. We deploy a mixture of consulting, staff augmentation, and training to level up teams and solve engineering problems. Whether it’s transitioning walmart.com to React, moving speedtest.net off Flash, or helping a startup build and scale an MVP, we’re ready to help teams of any size.

Interested in hiring or working for us? Get in touch or view our careers page.