A .NET test automation framework for API testing, built with xUnit and RestSharp.
-
Build and Test: Runs on pull requests and manual triggers
- Builds the solution
- Deploys Conductor server in Docker
- Executes all tests
- Generates comprehensive test reports (HTML, TRX, JUnit)
- Publishes test results to GitHub Checks
-
Build: Runs on every push
- Quick build validation
- Ensures code compiles correctly
Test results are automatically generated and available in multiple formats:
- HTML Report: Rich interactive report with detailed test information
- TRX Report: Native .NET test results format
- JUnit XML: Standard XML format for CI/CD integration
All reports are uploaded as artifacts and can be downloaded from the workflow run page.
- Built on .NET 8.0
- xUnit test framework integration
- Flexible HTTP request handling with support for multiple content types
- Comprehensive logging system
- Environment configuration management
- Attribute-based request parameter decoration
- Support for JSON, Form URL Encoded, and other content types
- Automated CI/CD with comprehensive test reporting
- SdkTestAutomation.Core: Core functionality for HTTP requests, attribute handling, and request resolvers
- SdkTestAutomation.Api: API-specific implementations and request/response models
- SdkTestAutomation.Utils: Utility classes, logging, and configuration management
- SdkTestAutomation.Tests: Test implementations and test base classes
- .NET 8.0 SDK
- IDE (Visual Studio, Rider, or VS Code)
- Docker (for running Conductor server locally)
- Clone the repository
- Rename
.env.templateto.envin theSdkTestAutomation.Testsdirectory - Update the
.envfile with your configuration:
CONDUCTOR_SERVER_URL=your_api_url
CONDUCTOR_AUTH_KEY=your_auth_key
CONDUCTOR_AUTH_SECRET=your_auth_secretdotnet testAll test classes should inherit from BaseTest which provides:
- Automatic test logging
- Test context management
- API client initialization
Example:
public class MyTests : BaseTest
{
[Fact]
public void MyTest()
{
// Your test implementation
}
}Create request models by inheriting from HttpRequest and using attributes:
public class MyRequest : HttpRequest
{
[UrlParameter]
public string QueryParam { get; set; }
[Header(Name = "Custom-Header")]
public string HeaderValue { get; set; }
[Body]
public string RequestBody { get; set; }
}[UrlParameter]: Add query parameters to the URL[Header]: Add HTTP headers[Body]: Specify request body content- All attributes support custom naming via the
Nameproperty
- JSON (
ContentType.Json) - Form URL Encoded (
ContentType.FormUrlEncoded) - None (
ContentType.None)
The framework includes a built-in logging system that automatically captures:
- Request details (URL, headers, body)
- Response information (status code, body)
- Test execution timestamps
- Custom log messages
- GitHub Actions: Go to the Actions tab and click on a workflow run
- Test Results Tab: View TRX and JUnit results directly in GitHub
- Artifacts: Download the
test-resultsartifact for all report formats - Job Summary: View a formatted test summary in the workflow job summary
- HTML: Interactive report with expandable test details
- TRX: Native .NET format, viewable in Visual Studio
- JUnit: Standard XML format for CI/CD tools
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
- Make your changes
- Ensure all tests pass locally
- Push your changes (triggers build workflow)
- Create a PR (triggers full build and test workflow)
- Check test results in the PR checks
This project is licensed under the terms provided in the LICENSE file.