Skip to content

Conversation

@thomhurst
Copy link
Owner

Enhanced Assertion Examples:

  • Added a new section in docs/docs/assertions/awaiting.md with detailed examples for complex assertions, including chaining, collection conditions, async operations, nested objects, exception details, and performance metrics. These examples demonstrate the flexibility of TUnit's assertion system.

Dependency Injection with TestContext:

  • Introduced a new section in docs/docs/test-lifecycle/test-context.md explaining how to use TestContext to access dependency injection services. Examples include accessing loggers, working with scoped services, and integrating services in custom extensions and test lifecycle hooks.

Code Consistency and Fixes:

  • Updated DependsOn attribute syntax in docs/docs/test-authoring/depends-on.md to use new[] for specifying types, improving clarity and alignment with modern C# practices.
  • Modified .csproj example in docs/docs/getting-started/installation.md to use a wildcard for the TUnit version, simplifying the setup process.

thomhurst and others added 2 commits August 3, 2025 23:14
- Fixed version placeholder in installation.md (changed from $(TUnitVersion) to *)
- Fixed syntax error in depends-on.md array syntax
- Created advanced/extension-points.md documenting ITestExecutor, IHookExecutor, and event receivers
- Created advanced/exception-handling.md with complete exception hierarchy documentation
- Created test-authoring/generic-attributes.md for type-safe generic attribute usage
- Created troubleshooting.md with common issues and solutions
- Created advanced/performance-best-practices.md for test performance optimization
- Enhanced test-context.md with service provider integration documentation
- Enhanced awaiting.md with extensive complex assertion examples

These improvements address missing documentation for key TUnit features and provide
clearer guidance for developers with practical examples and best practices.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Changed UseTestExecutor to TestExecutor (the correct attribute name)
- Changed RegisterEventReceiver to proper attribute-based registration
- Added examples showing event receivers are implemented as attributes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR focuses on enhancing TUnit's documentation with comprehensive guides and examples. The main purpose is to provide developers with detailed reference materials covering troubleshooting, advanced usage patterns, and practical examples.

  • Added extensive troubleshooting guide covering common issues and their solutions
  • Enhanced assertion examples with complex scenarios and patterns
  • Introduced documentation for dependency injection with TestContext
  • Added comprehensive guides for advanced topics like performance optimization, extension points, and exception handling
  • Created detailed documentation for generic attributes and their type-safe benefits

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
docs/docs/troubleshooting.md New comprehensive troubleshooting guide with 548 lines covering test discovery, execution issues, assertion failures, and platform-specific problems
docs/docs/test-lifecycle/test-context.md Added service provider integration section explaining dependency injection access through TestContext
docs/docs/test-authoring/generic-attributes.md New guide documenting generic attribute versions with type safety benefits and AOT compatibility
docs/docs/test-authoring/depends-on.md Updated DependsOn attribute syntax to use modern C# array initialization
docs/docs/getting-started/installation.md Simplified .csproj example to use wildcard version for TUnit package
docs/docs/assertions/awaiting.md Enhanced with 287 lines of complex assertion examples covering chaining, collections, async operations, and performance testing
docs/docs/advanced/performance-best-practices.md New comprehensive performance guide with optimization strategies for test discovery, execution, and CI/CD
docs/docs/advanced/extension-points.md New detailed guide covering all TUnit extension interfaces and implementation patterns
docs/docs/advanced/exception-handling.md New comprehensive exception handling guide covering TUnit's exception hierarchy and best practices

- Fixed ITestDiscoveryEventReceiver to have only OnTestDiscovered method
- Changed all event receiver methods to return ValueTask instead of Task
- Fixed parameter types (TestRegisteredContext, no TestResult in OnTestEnd)
- Fixed ITestRetryEventReceiver signature (only context and retryAttempt)
- Updated example to show event receivers as attributes with correct signatures

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Escaped <T> to &lt;T&gt; in all generic attribute headings
- Prevents MDX from interpreting <T> as an HTML tag

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Added detailed section on nested property injection with automatic initialization
- Included real-world example with test containers and WebApplicationFactory
- Documented how TUnit resolves dependency graphs and manages object lifetimes
- Added best practices and sharing strategies
- Covered advanced scenarios including circular dependency detection

This powerful feature enables advanced test orchestration with simple code,
letting TUnit handle initialization order and object lifetimes automatically.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants