razor icon indicating copy to clipboard operation
razor copied to clipboard

Improve Testing Methodology for Razor Language Server Endpoints

Open TanayParikh opened this issue 4 years ago • 0 comments

Our current methodology for testing razor language server endpoints is "mocking the world".

For example: https://github.com/dotnet/aspnetcore-tooling/blob/676a0d569d8f0eb6bb903cd333f5b22e4a7ed35e/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs#L182-L274

We've reached the point where we've essentially mocked every functionality. This is very cumbersome, time consuming and often doesn't give a "true" representation of code health.

As such, I don't believe it gives us a true tell of if the code works, or if our mocks work.

The purpose of this PR is to overhaul this strategy, preferably integrating directly with our providers so we can get a better idea of how the overall code behaves. This takes us further towards integration tests rather than unit tests, which in this specific scenario I believe would be beneficial in improving overall test quality.

TanayParikh avatar Apr 01 '21 19:04 TanayParikh