bUnit-dev / bUnit

bUnit is a testing library for Blazor components that make tests look, feel, and runs like regular unit tests. bUnit makes it easy to render and control a component under test’s life-cycle, pass parameter and inject services into it, trigger event handlers, and verify the rendered markup from the component using a built-in semantic HTML comparer.
https://bunit.dev
MIT License
1.14k stars 105 forks source link

Add experimental support for Mobile Blazor Bindings #89

Closed egil closed 1 year ago

egil commented 4 years ago

With #5 / #75 / beta-7, it should be possible to reuse the core parts of the library to add support for Mobile Blazor Bindings, including support for "razor based tests". The initial aim should be to render MBB-based components and do basics assertions against the rendered components.

Related:

Future investigations could include looking at how Xamarin apps are tested natively. Are their existing testing libs that can be reused, especially around the assertion parts.

egil commented 4 years ago

Hi @Eilon, at some point I would like to discuss this with you. My initial investigations showed that this could work well within the bUnit testing infrastructure in bunit.core, but it does require some changes (making things protected/virtual IIRC) to NativeComponentRenderer and/or MobileBlazorBindingsRenderer for me to hook into renderer and give bUnit the control it needs for testing.

Eilon commented 4 years ago

@egil that could be quite reasonable. Can you send a PR to Mobile Blazor Bindings to propose those changes? I tried to find the right balance for the design of the components, but the testing scenario isn't one that I have explored much yet, so I'm not surprised if there are a few things missing that would help this scenario.

egil commented 4 years ago

@Eilon, great. I will get back to this later then other more pressing issues are out of the way.

Eilon commented 4 years ago

Sounds good, I look forward to seeing what changes we should make!