HttpTestGen.TUnitGenerator
0.1.2
dotnet add package HttpTestGen.TUnitGenerator --version 0.1.2
NuGet\Install-Package HttpTestGen.TUnitGenerator -Version 0.1.2
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="HttpTestGen.TUnitGenerator" Version="0.1.2"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HttpTestGen.TUnitGenerator" Version="0.1.2" />
<PackageReference Include="HttpTestGen.TUnitGenerator"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
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 HttpTestGen.TUnitGenerator --version 0.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HttpTestGen.TUnitGenerator, 0.1.2"
#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 HttpTestGen.TUnitGenerator@0.1.2
#: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=HttpTestGen.TUnitGenerator&version=0.1.2
#tool nuget:?package=HttpTestGen.TUnitGenerator&version=0.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
HttpTestGen.TUnitGenerator
A .NET source generator that converts .http files into TUnit test code.
Overview
This package provides a source generator that automatically converts .http files in your project into fully functional TUnit test code at compile time. Perfect for API testing and integration testing scenarios.
Installation
<PackageReference Include="HttpTestGen.TUnitGenerator" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Features
- Automatic Test Generation: Converts
.httpfiles to TUnit tests at compile time - Rich HTTP Support: Supports all HTTP methods (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, TRACE)
- Header Processing: Full support for HTTP headers including custom headers
- Request Bodies: Support for JSON, XML, and text request bodies
- Response Assertions: Validate expected status codes and response headers
- Zero Runtime Overhead: Code generation happens at compile time
Usage
- Install the NuGet package in your test project
- Add
.httpfiles to your project - Build your project - test code is automatically generated
Example .http File
# Simple GET request
GET https://api.example.com/users
# POST request with JSON body
POST https://api.example.com/users
Content-Type: application/json
{
"name": "John Doe",
"email": "john@example.com"
}
### Expected response
HTTP 201
Content-Type: application/json
The generator will create TUnit test methods for each request in your .http files.
Requirements
- .NET Standard 2.0 or higher
- TUnit testing framework
License
This project is licensed under the MIT License.
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.CodeAnalysis.CSharp (>= 4.14.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.