Which bugs in a queue-triggered Azure Function can a test with a mocked QueueClient never catch? Every bug that lives in the storage service or in the trigger binding instead of in your code: the encoding of the queue message, a blob container that doesn't exist yet, the naming rules for containers and blobs, and the JSON the worker has to deserialize. A test against a real Azurite container catches all four. With one container for the whole test run, the sample's six tests, two of them through a running Functions host, finish in under ten seconds on my machine.
The unit testing article from earlier this year is the baseline: business logic in a service class, the function class tested with fakes, and a first look at Testcontainers. This series picks up where it stopped. Part 1 stays with Azure Storage, queues in and blobs out; the later parts cover Cosmos DB, Service Bus, architecture rules, contracts, load and CI.…