ProtoTest.Testcontainers 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ProtoTest.Testcontainers --version 1.1.0
                    
NuGet\Install-Package ProtoTest.Testcontainers -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ProtoTest.Testcontainers" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ProtoTest.Testcontainers" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="ProtoTest.Testcontainers" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ProtoTest.Testcontainers --version 1.1.0
                    
#r "nuget: ProtoTest.Testcontainers, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ProtoTest.Testcontainers@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ProtoTest.Testcontainers&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=ProtoTest.Testcontainers&version=1.1.0
                    
Install as a Cake Tool

ProtoTest.Testcontainers

Shared container-resource support used by ProtoTest's Testcontainers packages, and the application container for an application under test.

Use it directly to start an application image with the run, or when building another run-scoped container integration.

ProtoContainerResource<TContainer> handles start-once and release-once behaviour. Register a resource as a target's UseContainer(...) provider when the host should start it and expose values such as a connection string. The technology packages (ProtoTest.Sql.Testcontainers, ProtoTest.Messaging.RabbitMq.Testcontainers, ProtoTest.Devices.Mqtt.Testcontainers) build on this contract: run-scoped start-once, TryStart reporting instead of throwing, and UseContainer(...) chain providers.

ApplicationContainer starts an application image as run infrastructure and publishes the mapped address as ProtoTest:Applications:{application}:BaseUrl, so the application's REST clients, browser sessions and the readiness probe resolve that one container:

var api = ApplicationContainer.Container("Api", "mcr.microsoft.com/dotnet/samples:aspnetapp", port: 8080);
builder
    .AddInfrastructure(
        api.Application,
        chain => chain
            .UseConfigured()      // a configured key skips the container
            .UseContainer(api),
        api.BaseUrlKey)
    .AddHttpReadiness(api.Application, "/")
    .AddApplication(api.Application, app => app
        .AddRest(rest => rest.AddClient(api.Application))
        .AddWeb());

The published address is http://{hostname}:{mapped port}; the default readiness check waits for the declared port to accept a connection, and the configure callback adds container build options or a Testcontainers wait strategy. A machine without a container runtime reports the reason through TryStart, so the suite can skip instead of failing.

UseContainer(PostgresDatabase.Container()) adds the container behind the Docker probe (DockerProbe.IsAvailable()), so a configured or AppHost provider earlier in the chain wins and the container starts only when the environment cannot serve the target.

The package does not depend on a specific Testcontainers module. Technology packages supply their own module container (for example PostgresDatabase); ApplicationContainer builds on the Testcontainers core library.

Limits

  • The image and its readiness belong to the suite. ApplicationContainer knows only the image and the port it listens on - not the application's health endpoint, environment or protocol. Add AddHttpReadiness(application, path) for an HTTP-level wait.
  • One scheme: http. The mapped address is published as http://…; an image that only serves HTTPS is not covered - point the application at that environment through ProtoTest:Applications:{application}:BaseUrl instead.
  • UseContainer follows the Docker probe, not the piece's own condition. A provider earlier in the chain (a configured key, an AppHost resource) wins without probing, and a machine whose daemon does not answer skips the container with Docker is available as the recorded reason.

Learn more

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on ProtoTest.Testcontainers:

Package Downloads
ProtoTest.Messaging.RabbitMq.Testcontainers

A RabbitMQ container owned as a run-scoped resource for ProtoTest.Messaging.RabbitMq.

ProtoTest.Sql.Testcontainers

A database container owned as a run-scoped resource for ProtoTest.Sql.

ProtoTest.Devices.Mqtt.Testcontainers

A Mosquitto MQTT broker container owned as a run-scoped resource for ProtoTest.Devices.Mqtt.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.1 22 10/2/2026
1.1.0 48 10/2/2026
1.0.1 181 9/20/2026
1.0.0 110 9/20/2026