Getting Started
Get up and running with Pepper in minutes. This guide walks you through installation and generating your first test documentation.
Prerequisites
Before installing Pepper, make sure you have:
- .NET 8.0 SDK or later installed
- A .NET test project using NUnit, xUnit, or MSTest
Verify .NET Installation:
dotnet --version
Should output version 8.0.0 or higher
Installation
Install Pepper in your test project:
dotnet add package PepperBDD
After building, pepper.exe will be automatically copied to your project's output directory alongside your test assembly.
Adding StepDescription Attributes
Add [StepDescription] attributes to your page object methods:
Basic StepDescription
[StepDescription("Navigate to the login page")]
public void NavigateTo()
{
driver.Navigate().GoToUrl("https://app.example.com/login");
}
StepDescription with Variables
Use curly braces to include parameter values in your documentation:
[StepDescription("Enter username '{username}'")]
public void EnterUsername(string username)
{
usernameField.SendKeys(username);
}
Multiple Steps with Order
[StepDescription("Navigate to checkout page", Order = 1)]
[StepDescription("Fill in shipping information", Order = 2)]
[StepDescription("Select express shipping", Order = 3)]
public void CompleteCheckout(ShippingInfo info)
{
// Implementation
}
StepIgnore Attribute
Exclude helper methods from documentation:
[StepIgnore]
public void LogDebugInformation()
{
// This won't appear in docs
}
Adding CaseDescription
Add [CaseDescription] to your test methods:
[Test]
[CaseDescription("Verify user can log in with valid credentials")]
public void Login_ValidateSuccess()
{
loginPage.NavigateTo();
loginPage.EnterUsername("test@example.com");
loginPage.EnterPassword("password123");
loginPage.ClickLogin();
Assert.That(dashboard.IsDisplayed(), Is.True);
}
Generate Documentation
Build your project and run Pepper:
dotnet build
pepper -generateReport -project "C:\Path\To\Project" -output "TestReport.pdf"
Custom Attributes
Add custom metadata to your tests for richer documentation and test management integration.
Using CustomAttribute
[Test]
[CaseDescription("Verify user can log in")]
[CustomAttribute("Priority", "Critical")]
[CustomAttribute("TestRailId", "TC-001")]
public void Login_ValidateSuccess()
{
// Test implementation
}
Framework-Specific Alternatives
You can also use your test framework's native attributes:
- NUnit:
[Property("Key", "Value")] - xUnit:
[Trait("Key", "Value")] - MSTest:
[TestProperty("Key", "Value")]
Including in PDF
Use the -includeCustoms flag to show custom attributes in PDF reports:
pepper -generateReport -project "./MyTests" -output "report.pdf" -includeCustoms
Configuration Files
Use JSON configuration files for consistent, repeatable builds.
Example Configuration
{
"project": "./MyTestProject",
"output": "TestReport.pdf",
"reportName": "My Test Suite Documentation",
"font": "calibri",
"reportStyle": "structured",
"generateJson": true,
"includeCustoms": true,
"categories": "Smoke,Regression",
"logoSource": "./company-logo.png"
}
Using Config Files
pepper -config pepper.config.json
CLI parameters override config file values when both are provided.
CLI Reference
Commands
| Command | Description |
|---|---|
-generateReport |
Generate a report (PDF or HTML, based on output file extension) |
-generateJson |
Generate a JSON export |
-project |
Path to test project directory |
-output |
Output file path |
Customization Options
| Option | Description | Default |
|---|---|---|
-reportName |
Custom report title | Test Documentation Report |
-font |
Font family | calibri |
-reportStyle |
Layout style (structured, simple) | structured |
-logoSource |
Path to custom logo | None |
-includeCustoms |
Include custom attributes in report | false |
-categories |
Filter by categories | All |
Category Filtering Examples
| Filter | Description |
|---|---|
"Smoke" |
Exact match for "Smoke" category |
"Smoke,Regression" |
Include Smoke OR Regression |
"Smoke!Skip" |
Include Smoke, exclude Skip |
"~Search" |
Partial match (contains "Search") |
CI/CD Integration
GitHub Actions
- name: Build Test Project
run: dotnet build ./tests/MyTestProject
- name: Generate Test Documentation
run: ./tests/MyTestProject/bin/Debug/net8.0/pepper -generateReport -project ./tests/MyTestProject -output TestReport.pdf
- name: Upload Documentation
uses: actions/upload-artifact@v3
with:
name: test-documentation
path: TestReport.pdf
Azure DevOps
- task: DotNetCoreCLI@2
displayName: 'Build Tests'
inputs:
command: 'build'
projects: '**/MyTestProject.csproj'
- script: $(Build.SourcesDirectory)/tests/MyTestProject/bin/Debug/net8.0/pepper.exe -generateReport -project $(Build.SourcesDirectory)/tests/MyTestProject -output $(Build.ArtifactStagingDirectory)/TestReport.pdf
displayName: 'Generate Test Documentation'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'test-documentation'
Tips:
- Always build your test project before running Pepper
- Use configuration files for consistent settings
- Upload generated files as build artifacts