author-swa-integration-test

Writes end-to-end Static Web Assets integration tests exercising MSBuild build, publish, and pack targets.

1.2k|337|Updated Oct 13, 2022
One-click install
npx skills add https://github.com/dotnet/dotnet --skill author-swa-integration-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: author-swa-integration-test
Source: https://github.com/dotnet/dotnet/tree/main/src/sdk/.claude/skills/author-swa-integration-test
Command: npx skills add https://github.com/dotnet/dotnet --skill author-swa-integration-test

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Writing integration tests for .NET Static Web Assets requires knowing which test asset to reuse, which base class to inherit, which manifest to assert on, and how to modify projects at runtime without corrupting shared test assets. This Skill codifies that workflow so tests cover the full asset pipeline correctly.

Core Features & Use Cases

  • Test Asset Selection: A catalog of existing test projects (RazorComponentApp, RazorAppWithP2PReference, AssetGroupsSample, BlazorHosted, and more) mapped to features like scoped CSS, fingerprinting, compression, and asset groups.
  • Base Class Guidance: Chooses between AspNetSdkTest, AspNetSdkBaselineTest, and IsolatedNuGetPackageFolderAspNetSdkBaselineTest based on whether the test builds, publishes, packs, or compares baselines.
  • Manifest Assertion Patterns: Explains when to assert on staticwebassets.build.json versus the endpoints or publish manifests, including compressed asset variants and content-negotiated endpoints.
  • Use Case: When adding a feature that excludes certain static assets, the Skill directs you to verify the build manifest still contains the assets while the endpoints manifest shows zero matching endpoints.

Quick Start

Write a new Static Web Assets integration test that publishes a Razor class library through a P2P reference and asserts the compressed endpoints appear in the endpoints manifest.

Frequently Asked Questions about author-swa-integration-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a Static Web Assets integration test in the .NET SDK?

Pick a test asset from the catalog, copy it with CreateAspNetSdkTestAsset, modify the copy via WithProjectChanges or File.WriteAllText, then execute a build, publish, or pack command and assert on the appropriate manifest. Never modify the source asset on disk.

Which base class should I use for SWA integration tests?

Use AspNetSdkTest for build or publish tests checking specific manifest properties, AspNetSdkBaselineTest when comparing the full manifest against a baseline JSON snapshot, and IsolatedNuGetPackageFolderAspNetSdkBaselineTest for pack or pack-restore-build scenarios.

What is the difference between staticwebassets.build.json and the endpoints manifest?

The build manifest is unfiltered and contains all asset variants including compressed alternatives, making it the source of truth for asset properties. The endpoints manifest contains only endpoints surviving group filtering, representing what the app sees at runtime.

How do I verify a feature excludes static web assets?

Confirm the build manifest still contains the assets since it is unfiltered, then check the endpoints manifest has zero matching endpoints. Also verify unrelated assets keep their existing endpoints.

When should I not use this integration test approach?

Do not use it for unit tests of individual MSBuild tasks, which should be written directly. Baseline regeneration and troubleshooting test failures are handled by separate dedicated skills.