Unit testing frontend when using component library #1773
-
|
We will use BUnit to do unit tests in the frontend. We use Radzen as a component library. So what exactly is it that you would unit test? I assume you dont test the component library as that is already tested by them. E.g say we are building a page that perhaps has a table to show existing movies. A create form to upload new movies. Clicking the movie would open a dialog that shows details etc etc. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
That really depends on your architecture. If your Blazor Page is absent of any logic and only consists out of (3rd party) components that represent some state without business rules - probably there is no big need for unit testing (and therefore bUnit). We offer utilities to work with 3rd party components (like shallow rendering, stubs, fakes, and so on). If your component retrieves the movies inside its lifecycle and does some validation or other kind of logic - then bUnit might be a very good candidate for that. The same applies to form submit example. And yes:
|
Beta Was this translation helpful? Give feedback.
That really depends on your architecture. If your Blazor Page is absent of any logic and only consists out of (3rd party) components that represent some state without business rules - probably there is no big need for unit testing (and therefore bUnit).
We offer utilities to work with 3rd party components (like shallow rendering, stubs, fakes, and so on).
If your component retrieves the movies inside its lifecycle and does some validation or other kind of logic - then bUnit might be a very good candidate for that. The same applies to form submit example.
And yes: