A good example of a [[Flaky tests|Flaky test]] due to concurrent test execution is a REST API call I stumbled upon when building the sample repository for the Serverless Testing Workshop. I created a test suite for an API Gateway endpoint `GET /clubs` which was responsible for returning all sports clubs in the database which had a visibility=public field set on it. The backing Lambda functions simply performed a query against a DynamoDB table and returned the result. The test steps were pretty simple: 1. Arrange: write 6 clubs to DynamoDB, 3 with visibility=public and 3 with visibility=private 2. Act: Call the API endpoint over HTTP and get the response 3. Assert: Verify that exactly 3 results were returned and that their IDs matched those from the arrange phase The test suite also deleted all the data created in the arrange phase in its teardown step. The tests all worked fine until I created a separate test suite for a `POST /clubs` endpoint. This endpoint was responsible for creating a new club in DynamoDB. Now when I executed all the test suites, the new POST tests passed ok but my above GET test started failing. It was complaining that 4 results were being returned instead of the expected 3. But sometimes it still passed ok. I finally worked out that the interleaving of the two tests from separate suites was causing extra data to be created which affected the DynamoDB query target.