A comprehensive test automation framework for the Restful Booker API, featuring API integration tests, contract/schema validation tests, and performance tests using NBomber.
The test framework requires credentials to authenticate with the Restful Booker API. The framework supports multiple configuration sources in the following precedence order (highest to lowest):
- Environment Variables (Recommended for CI/CD)
- User Secrets (Recommended for local development)
- appsettings.json (Base configuration with placeholders)
Set the following environment variables:
export AppSettings__Credentials__UserName="your_username"
export AppSettings__Credentials__Password="your_password"For Windows PowerShell:
$env:AppSettings__Credentials__UserName="your_username"
$env:AppSettings__Credentials__Password="your_password"For local development, use .NET User Secrets to keep credentials out of source control:
# Navigate to the test project directory
cd tests/RestfulBookerTestFramework.Tests.Api
# Set the credentials
dotnet user-secrets set "AppSettings:Credentials:UserName" "your_username"
dotnet user-secrets set "AppSettings:Credentials:Password" "your_password"Repeat for other test projects (Tests.Contracts, Tests.Performance).
While you can modify appsettings.json files directly, this is not recommended as credentials should never be committed to source control.
The GitHub Actions workflows are configured to use GitHub Secrets for credential management. To set up:
- Navigate to your repository on GitHub
- Go to Settings → Secrets and variables → Actions
- Click New repository secret
- Add the following secrets:
- Name:
RESTFUL_BOOKER_USERNAME, Value: your API username - Name:
RESTFUL_BOOKER_PASSWORD, Value: your API password
- Name:
The workflows reference these secrets as:
env:
AppSettings__Credentials__UserName: ${{ secrets.RESTFUL_BOOKER_USERNAME }}
AppSettings__Credentials__Password: ${{ secrets.RESTFUL_BOOKER_PASSWORD }}Important: Never commit actual credentials to source control. Always use secrets management for CI/CD pipelines.