If you’re struggling to get developers on your team to write integration or E2E tests when building new features, here’s a quick technique to help.
I generally find that the root cause of this is not laziness, but rather that they don’t understand what they should be testing. With teams new to serverless, this can be a problem as they often aren’t sure of the failure modes of the services they’re using.
- Create a new test file for the feature being built
- Write out a list of
test.todo) statements for each test case, including happy paths and error cases. Add comments in where the test title isn’t sufficiently descriptive.
- Review the list with a colleague (over a PR or in a pairing session) before starting on implementation
Just taking the time to think through the different cases that your code needs to handle without the pressure of thinking about implementation details can really help clarify your thinking, improving the quality of both your test code and the application code.
Free Email Course
How to transition your team to a serverless-first mindset
In this 5-day email course, you’ll learn:
- Lesson 1: Why serverless is inevitable
- Lesson 2: How to identify a candidate project for your first serverless application
- Lesson 3: How to compose the building blocks that AWS provides
- Lesson 4: Common mistakes to avoid when building your first serverless application
- Lesson 5: How to break ground on your first serverless project