Skip to content

fszymaniak/RestfulBookerTestFramework

Repository files navigation

DotNet C# Reqnroll Git RestSharp Autofac Schema Testing NBomber

RestfulBookerTestFramework

A comprehensive test automation framework for the Restful Booker API, featuring API integration tests, contract/schema validation tests, and performance tests using NBomber.

Configuration

Credentials Setup

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):

  1. Environment Variables (Recommended for CI/CD)
  2. User Secrets (Recommended for local development)
  3. appsettings.json (Base configuration with placeholders)

Option 1: Environment Variables

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"

Option 2: User Secrets (Recommended for Local Development)

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).

Option 3: appsettings.json (Not Recommended)

While you can modify appsettings.json files directly, this is not recommended as credentials should never be committed to source control.

CI/CD Configuration with GitHub Secrets

The GitHub Actions workflows are configured to use GitHub Secrets for credential management. To set up:

  1. Navigate to your repository on GitHub
  2. Go to SettingsSecrets and variablesActions
  3. Click New repository secret
  4. Add the following secrets:
    • Name: RESTFUL_BOOKER_USERNAME, Value: your API username
    • Name: RESTFUL_BOOKER_PASSWORD, Value: your API password

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.

About

The testing framework of the Restful Booker API written in C#.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •