Watch out for brittleness due to forms that vary depending on geolocation

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the testing category.

Last Updated: 2024-11-23

I had an integration test against Stripe that worked locally and failed on CircleCI.

The reason: In the test driving the Stripe form, I went with the default country (i.e. I did not explicitly select one from the dropdown with my headless browser).

This was Germany on my development machine. But it was the USA on CircleCI. And when you are in the USA, Stripe adds a mandatory zip code field to the form, causing things to break (since I did not have to deal with this field in my local test ENV)

Lessons:

  1. Anticipate how geography of execution might cause brittleness in tests. Your location is implicit state.
  2. Fill out default fields with actual values in your tests to prevent surprises.