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
- Set a Foundation: Build an infrastructure everyone can use.
- Lower Barriers to Entry: Help new developers get acclimated with code and mentorship.
- Write it Down: Document everything test-related and keep things up-to-date.
- Teach & Learn: Provide onboarding and small, introductory test assignments.
- Fast
- Know What to Look For: Focus on the application behaviors most likely to be slowing down your tests (e.g., network and waits).
- Find the Slow Pokes: Use your test tools to identify what is slow during tests.
- Fake It: Programmatically “fake” the parts of your application that are slow during the tests.
- Offer Shortcuts: Provide developers with subsets of tests to run when the whole thing is too slow to regularly run.
- Friendly
- Find Champions: Encourage and promote developers who are considered project-wide testing leads.
- 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 SlideShare site, where the final PDF resides.