-
-
Notifications
You must be signed in to change notification settings - Fork 109
Add documentation for test artifacts/attachments #4074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: thomhurst <[email protected]>
Co-authored-by: thomhurst <[email protected]>
Co-authored-by: thomhurst <[email protected]>
Co-authored-by: thomhurst <[email protected]>
There was a problem hiding this 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 adds comprehensive documentation for TUnit's existing test artifact/attachment functionality, addressing user confusion about how to migrate from NUnit's TestContext.AddTestAttachment() API.
Key changes:
- New comprehensive artifacts guide covering test-level and session-level artifacts with real-world examples
- Updated test-context.md to document the
Output.AttachArtifact()API - Migration guide updates for NUnit, MSTest, and xUnit showing equivalent artifact attachment patterns
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
docs/docs/test-lifecycle/artifacts.md |
New comprehensive guide documenting artifact attachment at test and session levels, with best practices and common use cases (Playwright, API testing, database testing) |
docs/docs/test-lifecycle/test-context.md |
Added "Test Output and Artifacts" section explaining both Output.WriteLine() and OutputWriter.WriteLine() patterns, plus artifact attachment |
docs/sidebars.ts |
Added artifacts.md to the test-lifecycle section navigation |
docs/docs/migration/nunit.md |
Added test attachment migration example showing NUnit's TestContext.AddTestAttachment() mapped to TUnit's Artifact class |
docs/docs/migration/mstest.md |
Added test attachment migration example showing MSTest's TestContext.AddResultFile() mapped to TUnit's Artifact class |
docs/docs/migration/xunit.md |
Added test attachment migration example showing xUnit v3's FileAttachment mapped to TUnit's Artifact class |
docs/yarn.lock |
Dependency version updates (unrelated to the documentation feature) |
Description
TUnit already supports test artifacts via
TestContext.Output.AttachArtifact()andTestSessionContext.AddArtifact(), but lacked documentation. Users migrating from NUnit were confused by the missing equivalent toTestContext.AddTestAttachment().Added:
Comprehensive artifacts guide (
docs/docs/test-lifecycle/artifacts.md)Updated test-context.md
Output.WriteLine()(interface-based) andOutputWriter.WriteLine()(direct TextWriter) patternsUpdated migration guides (NUnit, MSTest, xUnit)
ArtifactclassExample usage:
Related Issue
Fixes #4612
Type of Change
Checklist
Required
TUnit-Specific Requirements
Testing
dotnet test)TestArtifactTests.csvalidates documented API)Additional Notes
Documentation builds successfully with Docusaurus. All internal links resolve correctly. Existing artifact test validates the documented API works as specified.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.