BUnit Versions Save

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.

v1.28.9

3 weeks ago

Fixed

  • bUnit's built-in HTML parser did not correctly parse full HTML documents that included a <!DOCTYPE html> as the first element. Fixed by @egil.
  • @formname directive led to an InvalidOperationException when used on a form element. Reported by @suzu2469 in #1438. Fixed by @egil/@linkdotnet.

Changed

  • NavigationManager is again registered as a singleton instead of scoped.

v1.27.17

2 months ago

Added

  • Support for IKeyedServiceProvider in net8.0. Reported by @ViRuSTriNiTy. By @linkdotnet.
  • Support for net9.0. NOTE, there is no commitment as of now to support net9.0 in bUnit v1. However. Support for net9.0 may move to a future v2 release of bUnit and be deprecated in v1. However, allowing bUnit to build and work with net9.0 previews allows our users to keep testing!

Fixed

v1.26.64

4 months ago

Changed

  • Upgraded AngleSharp to 1.0.7.

Fixed

  • When the TestContext was disposed, the Blazor Renderer itself didn't dispose components under test. By @linkdotnet.
  • When navigating, the HistoryEntryState on NavigationManager will be populated. By @linkdotnet.

Added

  • New overloads for IRenderedFragmentBase.InvokeAsync that allow retrieving the work item's return value. By @jcparkyn.

v1.25.3

6 months ago
  • Upgrade all .NET 8 preview dependencies to .NET 8 stable.

v1.24.10

7 months ago

Fixed

  • When the TestContext was disposed, it disposed of all services via the service provider. However, if there were ongoing renders happening, this could cause inconsistent state in the render tree, since the TestRenderer could try to access the service provider to instantiate components.
    This release changes the dispose phase such that the renderer gets disposed first, then the service provider. The disposal of any services that implement IAsyncDisposable is now also awaited. Fixed by @egil and @linkdotnet. Reported by @BenSchoen in https://github.com/bUnit-dev/bUnit/issues/1227.

Added

  • Support for custom service provider factories (IServiceProviderFactory<TContainerBuilder>). This enables the use of Autofac and other frameworks for dependency injection like on real-world ASP.NET Core / Blazor projects. By @inf9144.

  • Ability to raise the oncancel and onclose event, that was introduced with .NET 8.

v1.23.9

8 months ago

Fixed

  • If the renderer was not idle when calling SetParametersAndRender, the method could return before the parameters were set and the component under test had finished rendering. This was a regression that happened in v1.21.9. Reported by @Skintkingle in https://github.com/bUnit-dev/bUnit/issues/1188. Fixed by @egil.

Added

  • net8.0 support
  • Increased timeout of WaitForAssertion to infinite when a debugger is attached. By @linkdotnet.

Fixed

  • AngleSharp IElement extension methods do not work with IRenderedFragment.Find. Reported by a2er. Fixed by @linkdotnet.

v1.22.19

9 months ago

Added

  • Update bunit templates to support the target framework version of the project. By @linkdotnet.

Fixed

v1.21.9

10 months ago

Fixed

v1.20.8

11 months ago

Added

  • Added static DefaultWaitTimeout property to TestContext to enable overriding the default timeout of "wait for" methods like WaitForAssertion from 1 second to something else. By @egil.

Fixed

  • TestRenderer throws ObjectDisposedException if any methods is accessed after it has been disposed. It will also prevent changes to the internal render tree after it has been disposed. By @egil.

v1.19.14

1 year ago

Fixed

  • Custom elements with attributes throw ArgumentException with MarkupMatches. Reported by @candritzky. Fixed by @linkdotnet.

Changed

  • Changed test renderer such that updates to rendered components markup happen in the same synchronization context as the test framework is using (if any), if any, to avoid memory race conditions. By @egil.