Skip to main content
Breakdance provides first-class support for testing Azure Storage services using Azurite, Microsoft’s official Azure Storage emulator. The CloudNimble.Breakdance.Azurite package handles all the complexity of starting, configuring, and stopping Azurite instances during your test runs.

Prerequisites

Before you begin, ensure you have:
1

Node.js installed

Azurite runs on Node.js. Install it from nodejs.org or via your package manager.
2

Azurite installed globally

Install Azurite globally using npm:
3

NuGet package installed

Add the Breakdance Azurite package to your test project:

Quick Start

The simplest way to get started is to create a test class that inherits from AzuriteTestBase:
MyStorageTests.cs
Each test class owns its own static AzuriteInstance field. This design avoids cross-class pollution where multiple test classes would share the same instance, which can cause port conflicts and test interference.

Configuration Options

The AzuriteConfiguration class provides extensive options for customizing your Azurite instance:

Selecting Services

You can start only the services you need to reduce resource usage and startup time:
Table-only mode (AzuriteServiceType.Table alone) is currently not supported due to an upstream bug in Azurite where the table service reports incorrect port information. Use AzuriteServiceType.All if you need Table storage.

Storage Persistence

By default, Azurite runs with in-memory persistence, which is fast and automatically cleans up after tests:
For tests that need to persist data to disk:

Port Configuration

Breakdance automatically assigns random ports (20000-30000) to avoid conflicts when running tests in parallel:
If you need specific ports (not recommended for CI/CD):

All Configuration Options

Accessing Azurite

Once your test class is set up, AzuriteTestBase provides convenient properties for connecting to the services:
Endpoint properties return null if that service was not requested in the configuration. For example, if you set Services = AzuriteServiceType.Blob, then QueueEndpoint and TableEndpoint will be null.

Testing Patterns

Testing Blob Storage

Testing Queue Storage

Testing Table Storage

Advanced Scenarios

Sharing an Instance Across Multiple Test Classes

If you have many test classes that need the same Azurite configuration, you can use assembly-level initialization:
AssemblySetup.cs
Then reference it in your test classes:
When sharing an Azurite instance across test classes, be careful about test isolation. Tests that create containers or queues may interfere with each other. Consider using unique names (e.g., with Guid.NewGuid()) for test resources.

Using with Dependency Injection

If your application uses dependency injection, you can register Azure Storage clients with the Azurite connection string:

Troubleshooting

Ensure Node.js and Azurite are installed:
If Azurite is not found, install it globally: npm install -g azurite
By default, Breakdance uses random ports and retries on conflicts. If you’re seeing persistent port issues, check for orphaned Azurite processes:
Each test class should have its own static AzuriteInstance field. If you’re sharing an instance, use unique resource names in each test to avoid conflicts.
  • Use InMemoryPersistence = true for faster startup
  • Only start the services you need (e.g., AzuriteServiceType.Blob instead of All)
  • Consider sharing an instance across test classes if appropriate

Azurite Documentation

Official Microsoft documentation for Azurite

Azure Storage SDKs

.NET SDK documentation for Azure Storage