Menu

Azure Functions Integration Tests with Testcontainers and Azurite
📰

Azure Functions Integration Tests with Testcontainers and Azurite

DEV Community: dotnet·Martin Oehlert·16 days ago
#D1dg6HOH
#devtodotnet#devto#dev#pragma#test
Long article (5446 words) — no AI summary yet.
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.