Contributing to dotnet-test-rerun
Thank you for your interest in contributing to dotnet-test-rerun! This guide will help you get started.
Ways to Contribute
- π Report bugs and issues
- π‘ Suggest new features or improvements
- π Improve documentation
- π§ Submit bug fixes
- β¨ Add new features
- π§ͺ Add or improve tests
- π Share examples and use cases
Getting Started
Prerequisites
- .NET SDK 8.0, 9.0, or 10.0
- Git
- A code editor (Visual Studio, VS Code, Rider, etc.)
Fork and Clone
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/dotnet-test-rerun.git cd dotnet-test-rerun - Add the upstream repository:
git remote add upstream https://github.com/joaoopereira/dotnet-test-rerun.git
Build the Project
# Restore dependencies
dotnet restore
# Build the solution
dotnet build --configuration Release
# Run tests
dotnet test --configuration Release
Build should complete with no errors or warnings, and all 186 tests should pass.
Making Changes
Create a Branch
Create a feature branch from main:
git checkout -b feature/your-feature-name
Or for bug fixes:
git checkout -b fix/issue-description
Code Style
Follow the existing code style in the project:
- Use C# naming conventions
- Keep methods focused and small
- Add XML documentation comments for public APIs
- Write clear, descriptive commit messages
Commit Messages
Use Conventional Commits format:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation changestest: Adding or updating testsrefactor: Code refactoringperf: Performance improvementschore: Build process or tooling changesci: CI/CD changes
Examples:
feat(rerun): add delay option between retries
Add a new --delay option that allows users to specify
a delay in seconds between test retry attempts.
Closes #123
fix: handle null reference in test filter parsing
Fixes NullReferenceException when test filter is empty.
Fixes #456
docs: update usage examples with new options
Testing
Always add or update tests for your changes:
Unit Tests
Add unit tests to test/dotnet-test-rerun.UnitTests/:
[Fact]
public void NewFeature_Should_BehaveCorrectly()
{
// Arrange
var sut = new YourClass();
// Act
var result = sut.MethodUnderTest();
// Assert
result.Should().Be(expectedValue);
}
Integration Tests
Add integration tests to test/dotnet-test-rerun.IntegrationTests/ if your change affects test execution:
[Fact]
public async Task NewFeature_Integration_Should_Work()
{
// Test with actual test projects
}
Run Tests Locally
# Run all tests
dotnet test --configuration Release
# Run specific test project
dotnet test test/dotnet-test-rerun.UnitTests/
# Run with coverage
dotnet test /p:CollectCoverage=true
Pull Request Process
Before Submitting
- Update from upstream:
git fetch upstream git rebase upstream/main - Build and test:
dotnet build --configuration Release dotnet test --configuration Release - Update documentation if needed:
- Update README.md
- Update relevant documentation pages in
docs/ - Add examples if applicable
- Update CHANGELOG.md (if applicable): Follow the existing format and add your changes under βUnreleasedβ
Submit Pull Request
- Push your changes to your fork:
git push origin feature/your-feature-name -
Go to GitHub and create a Pull Request
- Fill in the PR template with:
- Description of changes
- Related issues (if any)
- Testing performed
- Screenshots (for UI changes)
- Ensure CI checks pass:
- Build succeeds
- All tests pass
- Code coverage is maintained or improved
- Commit messages follow conventional format
PR Review Process
- Maintainers will review your PR
- Address any feedback or requested changes
- Once approved, your PR will be merged
Reporting Issues
Bug Reports
When reporting bugs, include:
- Description: Clear description of the bug
- Steps to Reproduce: Detailed steps to reproduce the issue
- Expected Behavior: What should happen
- Actual Behavior: What actually happens
- Environment:
- OS (Windows, Linux, macOS)
- .NET SDK version
- dotnet-test-rerun version
- Test Project Details:
- Test framework (xUnit, NUnit, MSTest)
- Target framework
- Logs/Output: Relevant error messages or logs
Feature Requests
For feature requests, include:
- Problem: What problem does this solve?
- Proposed Solution: Your suggested approach
- Alternatives: Other approaches youβve considered
- Use Case: Real-world scenario where this helps
Development Guidelines
Project Structure
dotnet-test-rerun/
βββ src/ # Main application code
β βββ Analyzers/ # Test result analysis
β βββ Domain/ # Domain models
β βββ DotNetRunner/ # Test execution
β βββ Enums/ # Enumerations
β βββ Extensions/ # Utility extensions
β βββ Logging/ # Console output
β βββ RerunCommand/ # Main command logic
β βββ Program.cs # Entry point
βββ test/ # Test projects
β βββ dotnet-test-rerun.Common/
β βββ dotnet-test-rerun.UnitTests/
β βββ dotnet-test-rerun.IntegrationTests/
βββ docs/ # Documentation
Key Components
- RerunCommand: Main command logic, retry orchestration
- DotNetTestRunner: Executes
dotnet testand captures results - TestResultsAnalyzer: Parses TRX files to identify failed tests
- TestFilter: Builds test filters for rerunning specific tests
- Logger: Handles console output with Spectre.Console
Adding New Options
To add a new command-line option:
- Add the option to
RerunCommandConfiguration.cs:public Option<T> NewOption { get; set; } - Configure it in
RerunCommand.csconstructor:NewOption = new Option<T>( name: "--new-option", description: "Description of the option"); AddOption(NewOption); - Use it in the command handler:
var newValue = commandResult.GetValueForOption(NewOption); - Add tests for the new option
- Update documentation
Coding Standards
General Guidelines
- Follow SOLID principles
- Write testable code
- Use dependency injection
- Avoid static state
- Handle errors appropriately
Documentation
- Add XML comments for public APIs
- Update README.md for user-facing changes
- Add examples for new features
- Keep documentation clear and concise
Dependencies
- Minimize external dependencies
- Keep dependencies up to date
- Document why each dependency is needed
Release Process
Releases are managed by maintainers:
- Version is bumped using Versionize
- CHANGELOG.md is automatically updated
- Git tag is created
- NuGet package is published
- Docker images are built and pushed
Contributors donβt need to worry about releases, but should follow semantic versioning guidelines in commit messages.
Community Guidelines
- Be respectful and inclusive
- Welcome newcomers
- Provide constructive feedback
- Ask questions if unclear
- Help others when possible
Getting Help
- π GitHub Issues - Report bugs, request features
- π§ Contact maintainers via GitHub
Recognition
Contributors will be:
- Listed in the repositoryβs contributors section
- Mentioned in release notes (for significant contributions)
- Credited in the README
License
By contributing, you agree that your contributions will be licensed under the GNU General Public License v3.0.
Thank you for contributing to dotnet-test-rerun! π