Cross-posted from the Formidable Labs blog.
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:
- 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.
- 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.
- 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 in our comments below!)