deployment-e2e-testing
Guide for writing Aspire deployment end-to-end tests. Use this when asked to create, modify, or debug deployment E2E tests that deploy to Azure.
Install
mkdir -p .claude/skills/deployment-e2e-testing && curl -L -o skill.zip "https://mcp.directory/api/skills/download/5258" && unzip -o skill.zip -d .claude/skills/deployment-e2e-testing && rm skill.zipInstalls to .claude/skills/deployment-e2e-testing
About this skill
Aspire Deployment End-to-End Testing
This skill provides patterns and practices for writing end-to-end tests that deploy Aspire applications to real Azure infrastructure.
Overview
Deployment E2E tests extend the CLI E2E testing patterns with actual Azure deployments. They use the Hex1b terminal automation library to drive the Aspire CLI and verify that deployed applications work correctly.
Location: tests/Aspire.Deployment.EndToEnd.Tests/
Supported Platforms: Linux only (Hex1b requirement).
Prerequisites:
- Azure subscription with appropriate permissions
- OIDC authentication (CI) or Azure CLI authentication (local)
Relationship to CLI E2E Tests
Deployment tests build on the CLI E2E testing skill. Before working with deployment tests, familiarize yourself with:
- CLI E2E Testing Skill - Core terminal automation patterns
Key differences from CLI E2E tests:
| Aspect | CLI E2E Tests | Deployment E2E Tests |
|---|---|---|
| Duration | 5-15 minutes | 15-45 minutes |
| Resources | Local only | Azure resources |
| Authentication | None | Azure OIDC/CLI |
| Cleanup | Temp directories | Azure resource groups |
| Triggers | PR, push | Nightly, manual, deploy-test/* |
Key Components
Core Classes
DeploymentE2ETestHelpers(Helpers/DeploymentE2ETestHelpers.cs): Terminal factory and environment helpersDeploymentE2EAutomatorHelpers(Helpers/DeploymentE2EAutomatorHelpers.cs): Async extension methods onHex1bTerminalAutomatorfor deployment scenariosHex1bAutomatorTestHelpers(shared): Common async extension methods onHex1bTerminalAutomator(WaitForSuccessPromptAsync,AspireNewAsync, etc.)AzureAuthenticationHelpers(Helpers/AzureAuthenticationHelpers.cs): Azure auth and resource namingDeploymentReporter(Helpers/DeploymentReporter.cs): GitHub step summary reportingSequenceCounter(Helpers/SequenceCounter.cs): Prompt tracking (same as CLI E2E)
Test Architecture
Each deployment test:
- Validates Azure authentication (skip if not available locally)
- Generates a unique resource group name
- Creates a project using
aspire new - Deploys using
aspire deploy - Verifies deployed endpoints work
- Reports results to GitHub step summary
- Cleans up Azure resources
Test Structure
public sealed class MyDeploymentTests(ITestOutputHelper output)
{
[Fact]
public async Task DeployMyScenario()
{
// 1. Validate prerequisites
var subscriptionId = AzureAuthenticationHelpers.TryGetSubscriptionId();
if (string.IsNullOrEmpty(subscriptionId))
{
Assert.Skip("Azure subscription not configured.");
}
if (!AzureAuthenticationHelpers.IsAzureAuthAvailable())
{
if (DeploymentE2ETestHelpers.IsRunningInCI)
{
Assert.Fail("Azure auth not available in CI.");
}
Assert.Skip("Azure auth not available. Run 'az login'.");
}
// 2. Setup
var resourceGroupName = AzureAuthenticationHelpers.GenerateResourceGroupName("my-scenario");
var workspace = TemporaryWorkspace.Create(output);
var startTime = DateTime.UtcNow;
try
{
// 3. Build terminal and run deployment
using var terminal = DeploymentE2ETestHelpers.CreateTestTerminal();
var pendingRun = terminal.RunAsync(TestContext.Current.CancellationToken);
var counter = new SequenceCounter();
var auto = new Hex1bTerminalAutomator(terminal, defaultTimeout: TimeSpan.FromSeconds(500));
await auto.PrepareEnvironmentAsync(workspace, counter);
if (DeploymentE2ETestHelpers.IsRunningInCI)
{
await auto.SourceAspireCliEnvironmentAsync(counter);
}
await auto.AspireNewAsync("MyProject", counter, useRedisCache: false);
// ... deployment steps ...
await auto.TypeAsync("exit");
await auto.EnterAsync();
await pendingRun;
// 4. Report success
var duration = DateTime.UtcNow - startTime;
DeploymentReporter.ReportDeploymentSuccess(
nameof(DeployMyScenario),
resourceGroupName,
deploymentUrls,
duration);
}
catch (Exception ex)
{
DeploymentReporter.ReportDeploymentFailure(
nameof(DeployMyScenario),
resourceGroupName,
ex.Message);
throw;
}
finally
{
// 5. Cleanup Azure resources
await CleanupResourceGroupAsync(resourceGroupName);
}
}
}
Extension Methods
DeploymentE2EAutomatorHelpers Extensions on Hex1bTerminalAutomator
| Method | Description |
|---|---|
PrepareEnvironmentAsync(workspace, counter) | Sets up the terminal environment with custom prompt and workspace directory |
InstallAspireCliFromPullRequestAsync(prNumber, counter) | Downloads and installs the Aspire CLI from a PR build artifact |
InstallAspireCliReleaseAsync(counter) | Installs the latest released Aspire CLI |
SourceAspireCliEnvironmentAsync(counter) | Adds ~/.aspire/bin to PATH so the aspire command is available |
These extend Hex1bTerminalAutomator and are used alongside the shared Hex1bAutomatorTestHelpers methods (WaitForSuccessPromptAsync, AspireNewAsync, etc.) documented in the CLI E2E Testing Skill.
Azure Authentication
In CI (GitHub Actions)
Tests use OIDC (Workload Identity Federation) for authentication:
- name: Azure Login (OIDC)
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ vars.ASPIRE_DEPLOYMENT_TEST_SUBSCRIPTION }}
The test code automatically detects CI and uses DefaultAzureCredential which picks up the OIDC session.
Local Development
Authenticate with Azure CLI before running tests:
# Login to Azure
az login
# Set your subscription
az account set --subscription "your-subscription-id"
# Set environment variable
export ASPIRE_DEPLOYMENT_TEST_SUBSCRIPTION="your-subscription-id"
# Run tests
dotnet test tests/Aspire.Deployment.EndToEnd.Tests/
Authentication Helpers
// Check if auth is available
if (!AzureAuthenticationHelpers.IsAzureAuthAvailable())
{
Assert.Skip("Azure auth not available");
}
// Get subscription ID
var subscriptionId = AzureAuthenticationHelpers.GetSubscriptionId();
// Generate unique resource group name
var rgName = AzureAuthenticationHelpers.GenerateResourceGroupName("my-test");
// Result: "aspire-e2e-my-test-20240115-abc12345"
// Check auth type
if (AzureAuthenticationHelpers.IsOidcConfigured())
{
// Using OIDC (CI)
}
else
{
// Using Azure CLI (local)
}
Resource Group Naming
Resource groups are named with a consistent pattern for easy identification and cleanup:
{prefix}-{testname}-{date}-{runid}
Example: aspire-e2e-aca-starter-20240115-12345678
Components:
- prefix: From
ASPIRE_DEPLOYMENT_TEST_RG_PREFIX(default:aspire-e2e) - testname: Sanitized test name (lowercase, alphanumeric, hyphens)
- date: UTC date in YYYYMMDD format
- runid: GitHub run ID or random GUID suffix
Reporting Results
GitHub Step Summary
Tests automatically write to the GitHub step summary:
// Report success with URLs
DeploymentReporter.ReportDeploymentSuccess(
testName: "DeployStarterToACA",
resourceGroupName: "aspire-e2e-...",
deploymentUrls: new Dictionary<string, string>
{
["Dashboard"] = "https://dashboard.azurecontainerapps.io",
["Web Frontend"] = "https://webfrontend.azurecontainerapps.io"
},
duration: TimeSpan.FromMinutes(15));
// Report failure
DeploymentReporter.ReportDeploymentFailure(
testName: "DeployStarterToACA",
resourceGroupName: "aspire-e2e-...",
errorMessage: "Deployment timed out",
logs: "Full deployment logs...");
Asciinema Recordings
Tests generate recordings for debugging:
var recordingPath = DeploymentE2ETestHelpers.GetTestResultsRecordingPath(nameof(MyTest));
// CI: $GITHUB_WORKSPACE/testresults/recordings/MyTest.cast
// Local: /tmp/aspire-deployment-e2e/recordings/MyTest.cast
Cleanup
Always cleanup Azure resources in a finally block:
private static async Task CleanupResourceGroupAsync(string resourceGroupName)
{
var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "az",
Arguments = $"group delete --name {resourceGroupName} --yes --no-wait",
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false
}
};
process.Start();
await process.WaitForExitAsync();
if (process.ExitCode != 0)
{
var error = await process.StandardError.ReadToEndAsync();
throw new InvalidOperationException($"Cleanup failed: {error}");
}
}
Workflow Triggers
Deployment tests are triggered by:
- Nightly schedule (03:00 UTC) - Runs on
main - Manual dispatch - Via GitHub Actions UI
- Push to
deploy-test/*- For rapid iteration
Iterating on Tests
To iterate quickly during development:
# Create a protected branch
git checkout -b deploy-test/my-feature
# Make changes
# ...
# Push to trigger workflow
git push origin deploy-test/my-feature
Environment Variables
| Variable | Required | Description |
|---|---|---|
ASPIRE_DEPLOYMENT_TEST_SUBSCRIPTION | Yes | Azure subscription ID |
ASPIRE_DEPLOYMENT_TEST_RG_PREFIX | No | Resource group prefix (default: aspire-e2e) |
| `AZUR |
Content truncated.
More by dotnet
View all skills by dotnet →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversStructured Workflow guides disciplined software engineering via refactoring, feature creation, and test driven developme
Raindrop: AI DevOps to convert Claude Code into an infrastructure-as-code full-stack deployment platform, automating app
Uno Platform — Documentation and prompts for building cross-platform .NET apps with a single codebase. Get guides, sampl
XcodeBuild streamlines iOS app development for Apple developers with tools for building, debugging, and deploying iOS an
Connect Supabase projects to AI with Supabase MCP Server. Standardize LLM communication for secure, efficient developmen
Solana Agent Kit: Easily deploy tokens, mint NFTs, and manage DeFi & cross-chain tasks with Solana integration in chat i
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.