> ## Documentation Index
> Fetch the complete documentation index at: https://easyaf.nimbleapps.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Web & API Testing

> Test HTTP APIs and web services with in-memory servers, request snapshots, and response snapshots.

Breakdance provides multiple approaches for testing web APIs, each suited to different scenarios.
Choose based on your testing needs:

## Choose Your Approach

> [card] [In-Memory Testing](https://easyaf.nimbleapps.cloud/breakdance/guides/web/aspnet-core-rest.md)
>
> **Best for:** Unit testing HTTP APIs you're building without deploying infra
>
> Fast, no network overhead, great for CI/CD

> [card] [Request Snapshots](https://easyaf.nimbleapps.cloud/breakdance/guides/web/snapshots/requests.md)
>
> **Best for:** Replicating requests from 3rd party APIs
>
> `.http` files with variables, request chaining

> [card] [Response Snapshots](https://easyaf.nimbleapps.cloud/breakdance/guides/web/snapshots/responses.md)
>
> **Best for:** Replicating responses from 3rd party APIs
>
> Capture once, replay everywhere

## Quick Comparison

| Feature | In-Memory | Request Snapshots | Response Snapshots |
| - | - | - | - |
| Network calls | None | Optional | Captured |
| Test speed | Fastest | Fast | Fast (cached) |
| Real API testing | No | Yes | Initial capture |
| Offline capable | Yes | With snapshots | Yes |
| Request chaining | Manual | Built-in | N/A |
| Environment configs | N/A | Yes | Per-folder |

## Combining Approaches

These techniques work well together. See the [Snapshots Overview](https://easyaf.nimbleapps.cloud/breakdance/guides/web/snapshots/index.md) for the full philosophy.

```csharp theme={"dark"}
// Use .http file format with captured response snapshots
public class ApiTests : DotHttpTestBase
{
    protected override HttpMessageHandler CreateHttpMessageHandler()
    {
        // Serve responses from snapshot files
        return new ResponseSnapshotReplayHandler("ResponseSnapshots");
    }

    [TestMethod]
    public async Task GetUsers_Test()
    {
        SetVariable("baseUrl", "https://api.example.com");

        var response = await SendRequestAsync(new DotHttpRequest
        {
            Method = "GET",
            Url = "{{baseUrl}}/users"
        });

        await DotHttpAssertions.AssertValidResponseAsync(response);
    }
}
```

## Guides

> [card] [ASP.NET Core Testing](https://easyaf.nimbleapps.cloud/breakdance/guides/web/aspnet-core-rest.md)
>
> Test ASP.NET Core APIs with the built-in TestServer. Fast, in-memory testing
> with full dependency injection support.

> [card] [ASP.NET Classic Testing](https://easyaf.nimbleapps.cloud/breakdance/guides/web/aspnet-classic-rest.md)
>
> Test ASP.NET Web API 2 controllers on .NET Framework without a real HTTP server.
> Create an HttpClient wired directly to your API's routing pipeline.

> [card] [Snapshots Overview](https://easyaf.nimbleapps.cloud/breakdance/guides/web/snapshots/index.md)
>
> Learn about Breakdance's "Test Real Things" philosophy and how snapshots
> replace traditional mocking for API tests.

> [card] [Request Snapshots](https://easyaf.nimbleapps.cloud/breakdance/guides/web/snapshots/requests.md)
>
> Write API tests using Visual Studio's `.http` file format. Supports variables,
> environment files, and request chaining with response extraction.

> [card] [Response Snapshots](https://easyaf.nimbleapps.cloud/breakdance/guides/web/snapshots/responses.md)
>
> Capture HTTP responses from real APIs and replay them in tests. Perfect for
> testing against external services without network dependencies.

## Related Packages

| Package | Purpose |
| - | - |
| `Breakdance.WebApi` | In-memory Web API 2 testing on .NET Framework |
| `Breakdance.AspNetCore` | In-memory ASP.NET Core testing with TestServer |
| `Breakdance.DotHttp` | `.http` file parsing and test base class |
| `Breakdance.Assemblies` | Response snapshot handlers |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.