Integration test with Blazor WASM

Bence Mihucza 1 Reputation point
2022-09-18T07:33:06.28+00:00

Hi All,

Is there any possibilities to do integration tests with Blazor WASM application similar to .NET Core application?
I mean this kind of integration tests:
https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-6.0

Would be great if the whole stack would not have to be started for E2E tests.

Sorry if it is a noob question, I don't have too much experience on frontend side.

Thank you in advance.

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,383 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 55,366 Reputation points
    2022-09-18T15:26:47.317+00:00

    No, it will not work with blazor, because blazor is either hosted in the browser (WASM), or is a signalr connection that returns undocumented tokens.

    You need to a browser testing framework like Selenium

    https://www.selenium.dev/

    Note: you could test the webapi of the server with the integration test library

    0 comments No comments