A .NET source generator that converts .http files into xUnit test code. Automatically generates fully functional xUnit tests from HTTP requests at compile time.
$ dotnet add package HttpTestGen.XunitGeneratorA .NET source generator that converts .http files into xUnit test code.
This package provides a source generator that automatically converts .http files in your project into fully functional xUnit test code at compile time. Perfect for API testing and integration testing scenarios.
<PackageReference Include="HttpTestGen.XunitGenerator" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
.http files to xUnit tests at compile time.http files to your project# 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 xUnit test methods for each request in your .http files.
This project is licensed under the MIT License.