Overview
Extend the playground project to support automated end-to-end testing that validates ReferenceCop's key scenarios in PR and official build workflows.
Context
Currently, the playground project in playground/ provides a manual testing environment where developers can:
- Build the ReferenceCop package
- Test it against sample projects with various rule violations
- Validate changes end-to-end before committing
This works well for manual validation, but we should automate this to ensure all key scenarios are tested on every check-in.
Goals
-
Create automated test scenarios that validate all ReferenceCop rule types:
AssemblyName rules (e.g., blocking Newtonsoft.Json)
ProjectTag rules (e.g., preventing App projects from referencing Tools)
ProjectPath rules (e.g., preventing App from referencing Internal libraries)
-
Integrate these tests into GitHub Actions workflows:
- Run on every PR build
- Run on official builds
- Fail the build if any scenario doesn't produce expected results
-
Test both positive and negative scenarios:
- Verify violations are correctly detected (build fails with expected diagnostics)
- Verify valid references are allowed (build succeeds)
Implementation Approach
Option 1: PowerShell Test Runner
Create a test runner script that:
- Builds various test configurations in the playground
- Validates expected build outcomes (success/failure)
- Checks for expected diagnostic messages
- Returns appropriate exit codes for CI/CD
Option 2: Integration Test Project
Create a proper MSTest/xUnit test project that:
- Uses the playground projects as test fixtures
- Invokes MSBuild programmatically
- Asserts on build results and diagnostics
- Integrates with existing test infrastructure
Option 3: Combination
- Use PowerShell for simple scenario validation
- Add integration tests for complex validation logic
- Both run in CI/CD pipeline
Acceptance Criteria
Benefits
- Catch regressions early in the development cycle
- Ensure all rule types work correctly across releases
- Provide confidence when accepting community contributions
- Validate package integration scenarios automatically
- Reduce manual testing effort
Related
- Playground:
playground/
- Test scenarios reference:
playground/TEST-SCENARIOS.md
- Build workflows:
.github/workflows/
Overview
Extend the playground project to support automated end-to-end testing that validates ReferenceCop's key scenarios in PR and official build workflows.
Context
Currently, the playground project in
playground/provides a manual testing environment where developers can:This works well for manual validation, but we should automate this to ensure all key scenarios are tested on every check-in.
Goals
Create automated test scenarios that validate all ReferenceCop rule types:
AssemblyNamerules (e.g., blocking Newtonsoft.Json)ProjectTagrules (e.g., preventing App projects from referencing Tools)ProjectPathrules (e.g., preventing App from referencing Internal libraries)Integrate these tests into GitHub Actions workflows:
Test both positive and negative scenarios:
Implementation Approach
Option 1: PowerShell Test Runner
Create a test runner script that:
Option 2: Integration Test Project
Create a proper MSTest/xUnit test project that:
Option 3: Combination
Acceptance Criteria
.github/workflows/pr-build.yamlor similar).github/workflows/official-build.yaml)Benefits
Related
playground/playground/TEST-SCENARIOS.md.github/workflows/