Skip to content
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

Replace our custom test harness with Microsoft.CodeAnalysis testing harness #65

Merged

Conversation

MattKotsenas
Copy link
Collaborator

Move from our own custom analyzer harness to the one provided by the Roslyn team (Microsoft.CodeAnalysis.Testing). This harness is a lot more powerful in that it supports automatic verification of:

  • Suppressing diagnostics
  • Verifying generate code analysis
  • Verifying the test code is doesn't have unexpected errors (i.e. test code errors)
  • Testing against multiple TFMs
  • Testing with multiple versions of PackageReferences
  • Baselining diagnostics via markup in the test code

Unfortunately, the harness is also quite a bit slower. On my machine test times regress from ~2 seconds to ~40 seconds. I've filed #64 to track.

In order for our test code to actually compile we need to move our Microsoft.CodeAnalysis.CSharp.Workspaces from 2.6.1 (.NET Core 2.0 era) to 3.4.1 (.NET 6 era). This does impact where our analyzer can run, so I picked the oldest supported version. We could avoid this upgrade if we either:

  1. Switched away from file-scoped usings
  2. Figure out Refactor tests to cover both global and namespace uses #56

@rjmurillo rjmurillo added this to the vNext milestone Jun 7, 2024
@rjmurillo rjmurillo merged commit 3a04df3 into rjmurillo:master Jun 7, 2024
3 checks passed
@MattKotsenas MattKotsenas deleted the refactor/use-roslyn-test-harness branch June 7, 2024 17:00
@github-actions github-actions bot added dependencies Pull requests that update a dependency file documentation build labels Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build dependencies Pull requests that update a dependency file documentation housekeeping
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants