-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(deps): update dependency bunit to 1.36.0 #192
Open
renovate
wants to merge
1
commit into
master
Choose a base branch
from
renovate/bunit-1.x
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
November 20, 2022 14:55
4e9e2cf
to
047c698
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.10.14
chore(deps): update dependency bunit to v1.12.6
Nov 20, 2022
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
6 times, most recently
from
December 16, 2022 10:28
26a486d
to
f67d156
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.12.6
chore(deps): update dependency bunit to v1.13.5
Dec 16, 2022
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.13.5
Update dependency bunit to v1.13.5
Dec 17, 2022
renovate
bot
changed the title
Update dependency bunit to v1.13.5
chore(deps): update dependency bunit to v1.13.5
Dec 17, 2022
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
January 11, 2023 22:08
f67d156
to
3ae5b56
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.13.5
chore(deps): update dependency bunit to v1.14.4
Jan 11, 2023
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
January 23, 2023 06:41
3ae5b56
to
93a09ed
Compare
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
February 4, 2023 19:10
93a09ed
to
a32d34b
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.14.4
chore(deps): update dependency bunit to v1.15.5
Feb 4, 2023
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
February 8, 2023 03:56
a32d34b
to
bd7538d
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.15.5
chore(deps): update dependency bunit to v1.16.2
Feb 8, 2023
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
February 22, 2023 11:17
bd7538d
to
f409394
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.16.2
chore(deps): update dependency bunit to v1.17.2
Feb 22, 2023
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
February 26, 2023 11:35
f409394
to
65c5626
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.17.2
chore(deps): update dependency bunit to v1.18.4
Feb 26, 2023
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
March 24, 2023 20:59
65c5626
to
32099f9
Compare
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
April 26, 2023 18:29
32099f9
to
10d4e62
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.18.4
chore(deps): update dependency bunit to v1.19.14
Apr 26, 2023
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
May 21, 2023 12:37
10d4e62
to
5a6e245
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.19.14
chore(deps): update dependency bunit to v1.20.8
May 21, 2023
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
July 2, 2023 16:43
5a6e245
to
18113d6
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.20.8
chore(deps): update dependency bunit to v1.21.9
Jul 2, 2023
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
July 28, 2023 15:46
18113d6
to
9f2e887
Compare
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
3 times, most recently
from
September 6, 2023 12:39
853d3ee
to
f560910
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.22.19
chore(deps): update dependency bunit to v1.23.9
Sep 6, 2023
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
October 14, 2023 21:20
f560910
to
1ad6c9a
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.23.9
chore(deps): update dependency bunit to v1.24.10
Oct 14, 2023
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.24.10
chore(deps): update dependency bunit to v1.25.3
Nov 14, 2023
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
November 14, 2023 23:03
1ad6c9a
to
e11a4c1
Compare
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
December 20, 2023 14:06
e11a4c1
to
67ed588
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.25.3
chore(deps): update dependency bunit to v1.26.64
Dec 20, 2023
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
March 2, 2024 16:59
67ed588
to
df103a7
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.26.64
chore(deps): update dependency bunit to v1.27.17
Mar 2, 2024
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
April 19, 2024 16:48
df103a7
to
6d63287
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.27.17
chore(deps): update dependency bunit to v1.28.9
Apr 19, 2024
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
July 7, 2024 20:56
6d63287
to
56d65af
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.28.9
chore(deps): update dependency bunit to v1.29.5
Jul 7, 2024
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
July 21, 2024 20:26
56d65af
to
00d280f
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.29.5
chore(deps): update dependency bunit to v1.30.3
Jul 21, 2024
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
August 16, 2024 15:31
00d280f
to
1766608
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.30.3
chore(deps): update dependency bunit to v1.31.3
Aug 16, 2024
renovate
bot
changed the title
chore(deps): update dependency bunit to v1.31.3
chore(deps): update dependency bunit to 1.31.3
Aug 28, 2024
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
October 4, 2024 19:24
1766608
to
f5a636a
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to 1.31.3
chore(deps): update dependency bunit to 1.32.7
Oct 4, 2024
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
October 11, 2024 16:31
f5a636a
to
c499ec2
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to 1.32.7
chore(deps): update dependency bunit to 1.33.3
Oct 11, 2024
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
November 1, 2024 10:14
c499ec2
to
e9650fd
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to 1.33.3
chore(deps): update dependency bunit to 1.34.0
Nov 1, 2024
renovate
bot
force-pushed
the
renovate/bunit-1.x
branch
from
November 12, 2024 20:56
e9650fd
to
55f2381
Compare
renovate
bot
changed the title
chore(deps): update dependency bunit to 1.34.0
chore(deps): update dependency bunit to 1.36.0
Nov 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
None yet
0 participants
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.0.0-beta-11
->1.36.0
Release Notes
bUnit-dev/bUnit (bunit)
v1.36.0
Added
v1.35.3
Added
bunit.generators
andbunit.web.query
) are flagged as stable.v1.34.0
Fixed
Microsoft.Extensions.Caching.Memory
. Reported by @polajenko. Fixed by @linkdotnet.v1.33.3
Added
bunit.generators
respect parameters from the base class.net9.0
.Fixed
System.Text.Json
due to CVE in8.0.4
.v1.32.7
Fixed
WaitForAssertion
and related methods is always performed at once before the wait timer is started. If not, the timeout could occure before a wait-for check-condition had been attempted, causing tests to fail without reason. Fixed by @egil.v1.31.3
Fixed
UploadFile
should only throw an exception when the file size exceeds the maximum allowed size. Reported by @candritzky. Fixed by @linkdotnet.v1.30.3
Fixed
UploadFile
doesn't throw an exception when the file size exceeds the maximum allowed size. Reported by @MorneZaayman in #1503. Fixed by @linkdotnet.v1.29.5
Fixed
v1.28.9
Fixed
@formname
directive led to anInvalidOperationException
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
Added
IKeyedServiceProvider
in net8.0. Reported by @ViRuSTriNiTy. By @linkdotnet.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
SupplyFromQueryParameter
in net8.0. Reported by @aayjaychan. Fixed by @egil and @linkdotnet.v1.26.64
Changed
AngleSharpWrappers
is not needed anymore. Any usage ofUnwrap
should not be needed anymore.Fixed
TestContext
was disposed, the Blazor Renderer itself didn't dispose components under test. By @linkdotnet.HistoryEntryState
onNavigationManager
will be populated. By @linkdotnet.Added
IRenderedFragmentBase.InvokeAsync
that allow retrieving the work item's return value. By @jcparkyn.v1.25.3
v1.24.10
Fixed
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 theTestRenderer
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 #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
andonclose
event, that was introduced with .NET 8.v1.23.9
Fixed
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 #1188. Fixed by @egil.Added
net8.0
supportWaitForAssertion
to infinite when a debugger is attached. By @linkdotnet.Fixed
IRenderedFragment.Find
. Reported by a2er. Fixed by @linkdotnet.v1.22.19
Added
Fixed
Calling
MarkupMatches(RenderFragment)
from a lambda passed to e.g.WaitForAssertion
could lead to a deadlock in certain circumstances. Fixed by @linkdotnet. Reported by @uecasm in #1143.Rendering complex component hierarchies could result in a stack overflow. Fixed by @egil.. Reported by @groogiam in #1064.
Remove capturing and dispatching markup updates to test frameworks synchronization context again. This could cause deadlocks and does not have any impact on test stability. Fixed by @egil. Reported by @biohazard999 in #1144.
v1.21.9
Fixed
Allow using 3rd party
IComponentActivator
at the same time as component factories. By @egil. Reported by BenSchoen in #1129.Calling
IRenderedComponent.Render()
orIRenderedComponent.SetParametersAndRender()
did not batch up multiple synchronous re-renders after setting parameters. This is now changed such that the method causes the component to re-render with new parameters in the same way as if a parent component had passed new parameters to it. By @egil. Reported by @Jcparkyn in #1119.v1.20.8
Added
DefaultWaitTimeout
property toTestContext
to enable overriding the default timeout of "wait for" methods likeWaitForAssertion
from 1 second to something else. By @egil.Fixed
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
Fixed
ArgumentException
withMarkupMatches
. Reported by @candritzky. Fixed by @linkdotnet.Changed
v1.18.4
Fixed
@onclick:preventDefault
attribute set. Reported by @linkdotnet. Fixed by @egil.v1.17.2
@onclick:preventDefault
attribute. By @JelleHissink.v1.16.2
<path>
element parsed without being inside a<svg>
element. The semantic comparer will now be able to treat those as regular elements and thus be able to compare correctly to other elements of the same type and with the same node name. By @egil.v1.15.5
v1.14.4
Added
IMemoryCache
by default to the Services container. By @linkdotnet.Fixed
FakeNavigationManager
to handle umlauts.v1.13.5
This release contains a bunch of small tweaks and fixes.
v1.12.6
Fixed
v1.11.7
Added
StateFromJson
method to theNavigationHistory
type, to make it easy to deserialize navigation state stored as JSON during a call toNavigationManager.NavigateTo
, e.g. as seen with the newInteractiveRequestOptions
type available in .NET 7. By @linkdotnet and @egil.v1.10.14
Added
Added new test double
FakeWebAssemblyHostEnvironment
that implementsIWebAssemblyHostEnvironment
. By @KristofferStrube.Added
Bind
method to parameter builder that makes it easier to emulate the@bind-Value
syntax in C#-based tests.Added support for
NavigationLock
, which allows user code to intercept and prevent navigation. By @linkdotnet and @egil.Fixed
JSInterop.VerifyInvoke
reported the wrong number of actual invocations of a given identifier. Reported by @otori. Fixed by @linkdotnet.v1.9.8
Changed
WaitForAssertion
method is now marked as an assertion method with the[AssertionMethod]
attribute. This makes certain analyzers like SonarSource's Tests should include assertions happy. By @egil.Fixes
A race condition existed between
WaitForState
/WaitForAssertion
andFindComponents
, if the first used the latter. Reported by @rmihael, @SviatoslavK, and @RaphaelMarcouxCTRL. Fixed by @egil and @linkdotnet.Triggering of event handlers now runs entirely inside the renderers synchronization context, avoiding race condition between elements in the DOM tree being updated by the renderer and the event triggering logic traversing the DOM tree to find event handlers to trigger. Reported by @FlukeFan. Fixed by @egil.
v1.8.15
Added
InputFile
component. Learn more in the documentation. By @egil and @linkdotnet.Changed
Htmlizer
usesStringBuilder
instead ofList<string>
to reduce allocations and improve render speed. By @linkdotnet.Fixes
TestServiceProvider
now implementsIAsyncDisposable
. This meansTestContext.Dispose()
now calls the async disposable method as well as the non-async version on the service provider. It does however not block or await the task returned, since that can lead to deadlocks.Create a new type that derives from
TestContext
and which implementIAsyncDisposable
.In the
DisposeAsync()
method, callServices.DisposeAsync()
.Override the
Dispose
and have it only callServices.Dispose()
.Reported by @vedion and fixed by @egil.
v1.7.7
Added
Added method
SetAuthenticationType
toTestAuthorizationContext
to allow for custom authentication type checks. By @TimPurdum.Added
DisposeComponents
toTestContextBase
. It will dispose and remove all components rendered by theTestContextBase
. By @linkdotnet.Added .NET 7 as a target framework for bUnit. By @linkdotnet.
Fixed
Fixed step by step guide for building and viewing the documentation locally. By @linkdotnet.
FakeNavigationManager.NavigateTo
could lead to exceptions when navigating to external url's. Reported by @TDroogers. Fixed by @linkdotnet.v1.6.4
A quick minor release that primiarily fixes a regression in 1.5.12.
Fixed
ClickAsync
could lead to bubbling exceptions fromGetDispatchEventTasks
even though they should be handled. Reported by @aguacongas. Fixed by @linkdotnet.v1.5.12
This first release of 2022 includes one fix and four additions. A huge thank you to Steven Giesel (@linkdotnet) and Denis Ekart (@denisekart) for their contributions to this release.
Also a big shout out to bUnit's sponsors who helped make this release happen.
The higher tier sponsors are:
Other sponsors are:
Added
FakeSignOutSessionStateManage
type in Blazor, that makes it easy to test components that use theSignOutSessionStateManage
type. By @linkdotnet.AddChildContent
method inComponentParameterCollectionBuilder
that will throw an exception if the component'sChildContent
is a generic type. By @denisekart.Click
andDoubleClick
extensions which were introduced in .NET 5 and .NET 6. By @linkdotnet.Nunit
andMSTest
unit test frameworks. By @denisekart.Fixed
GetDispatchEventTasks
for bubbling events such that handled exceptions are not rethrown later from theWaitFor...
helpers methods. Reported by @AndrewStrickland. Fixed by @linkdotnetv1.4.15
This release reintroduces
Stub<TComponent>
and related back into the main library, so the "preview" librarybunit.web.mock
is already obsolete.A big shout out to bUnit's sponsors who helped make this release happen.
The higher tier sponsors are:
Other sponsors are:
Added
ComponentFactories
extensions method that makes it easy to register an instance of a replacement component. By @egil.ServiceProviderOptions
toTestServiceProvider
through property to allow users to customize the service provider. By @rodolfograve.Fixed
SetParametersAndRender
such that it rethrows any exceptions thrown by the component under testsSetParametersAsync
method. Thanks to @bonsall for reporting the issue. Fixed by @egil.onclick
on a button inside a form will raise theonsubmit
event for the form itself. Reported by [@egil]. Fixed by @linkdotnet.onsubmit
event handler. Whenonsubmit
is invoked from a non-form element results in an exception. Fixed by @linkdotnet.v1.3.42
This release includes support for .NET 6, with support for all new features in Blazor with that release. There are also a number of additions and fixes, all listed below.
Big shout out to bUnit's sponsors who helped make this release happen.
The higher tier sponsors are:
Other sponsors are:
Added
List of added functionality in this release.
Added support for writing tests of components that use the
<FocusOnNavigate>
component included in .NET 6. This includes an assertion helper methodVerifyFocusOnNavigateInvoke
on bUnit'sJSInterop
that allow you to verify that<FocusOnNavigate>
has set focus on an element during render. For example, to verify thath1
selector was used to pick an element to focus on, do:Added fake version of the
PersistentComponentState
type in Blazor that makes it possible to test components that use the type. By @egil.Added
TriggerEvent
method to make it easier to trigger custom events. By @egil.Added
History
capture in theFakeNavigationManager
. By @egil.Added new bUnit component mocking library, available via NuGet as
bunit.web.mock
. It is currently in preview and the features/APIs of it will change!Added
WaitForElement
andWaitForElements
methods. These makes it possible to wait for one or more elements to appear in the DOM before continuing a test, similar to howWaitForAssertion
allows you to wait for an assertion to pass, orWaitForState
allows you to wait for a predicate to pass. By @egil.Changed
Change()
andInput()
event trigger methods. This means that e.g. aDateTime
passed toChange()
is automatically converted to a string format that Blazor expects. By @egil.Fixed
The
Click
andDoubleClick
extension methods now set theMouseEventArgs.Detail
property to1
and2
respectively by default, unless the user specifies something else. This makes the methods more correctly emulate how Blazor reports single or double clicks on an element in the browser. Thanks to @David-Moreira for the help troubleshooting this issue. By @egil.FocusAsync()
method handler onElementReference
and<FocusOnNavigate>
js handler return completedTask
. By @anddrzejb.Fixes handling of disposed event handlers of bubbling events. See issue #518 for details. Thanks to @David-Moreira for helping debug this issue.
Async event trigger methods are not public. In most circumstances you do not need to use them, but if you have a scenario where you want to check that something has not happened after an event handler was triggered, then you can use the async methods and await them to know when they are completed. See #552 for details. By @egil.
v1.2.49
Added
List of added functionality in this release.
Added more extensions methods to
MarkupMatchesAssertExtensions
to allow asserting withMarkupMatches
onIEnumerable
andIElement
. By @jgoday.Added
BunitErrorBoundaryLogger
implementation ofIErrorBoundaryLogger
(needed for Blazor's ErrorBoundary component in .NET 6.0). By @jgoday.Added
ComponentFactories
property to theTestContextBase
type. TheComponentFactories
property is aComponentFactoryCollection
type that containsIComponentFactory
types. These are used by bUnits component activator, whenever a component is created during testing. If no component factories is added to the collection, the standard component activator mechanism from Blazor is used. This feature makes it possible to control what components are created normally during a test, and which should be e.g. replaced by a test dummy. More info is available in issue #388.Learn more about this feature on the Controlling component instantiation page.
Added
HasComponent<TComponent>()
toIRenderedFragement
. Use it to check if the rendered fragment contains a component of typeTComponent
. Added by @egil.Added
AddStub
andAdd
extension methods toComponentFactories
that makes it easy to configure bUnit to replace components in the render tree with stubs. Both methods have overloads that allow for fine grained selection of component types to "double" during testing. Added by @egil in #400.Changed
List of changes in this release.
Updated AngleSharp and related libraries to 0.16.0. NOTE, the new version of AngleSharp includes nullable annotations, which might affect how your code compiles, if you have nullable checking enabled in your test project. By @egil.
Updated .NET 6 dependencies to preview 5. By @egil.
Fixed
List of fixes in this release.
Fixed JSInterop error message when trying to import an unconfigured module. By @jgoday in #425.
Fixed issue where a registered fall-back service provider was not made available to resolve service dependencies of components under test. Thanks to @dady8889 for the reporting the issue.
Fixed handling of escaped uri's in FakeNavigationManager. By @linkdotnet in #460.
Captured error message from event dispatcher in renderer that would previously be hidden from the user. Related to issue #399.
v1.1.5
Added
All bUnit assemblies is now strong named signed.
Added .NET 6 (preview 3) as a target framework for bUnit, bUnit.core and bUnit.web.
Changed
Changed bunit.template such that created projects only reference the bUnit package. Bumped other referenced packages to latest version.
Changed TestServiceProvider to validate scopes of registered services, such that it behaves like the service provider (default IoC container) in Blazor.
v1.0.16
The following section list all changes since preview 02.
Changed
List of changes in existing functionality.
BREAKING CHANGE: Writing tests using the test components
<Fixture>
and<SnapshotTest>
components inside .razor files has been moved to its own library,bunit.web.testcomponents
. This was done for several reasons:The feature has been experimental since it was introduced, and it was introduced get a more natural way of specifying the component under test and any related markup used by test.
The feature is only supported with xUnit.
There are some issues related to the
SourceFileFinder
library, which is used to discover the test components.A better way of writing tests in .razor files has been added to bUnit, using "inline render fragments". This method works with all general purpose test frameworks, e.g. MSTest, NUnit, and xUnit, is more flexible, and offer less boilerplate code than the test components. The bUnit documentation has been updated with a guide to this style.
Removed
List of now removed features.
The
AddXunitLogger
method, which provided support for capturingILogger
messages and passing them to xUnit'sITestOutputHelper
, has been removed. There were no need to keep xUnit specific code around in bUnit going forward, and there are many implementations on-line that supports this feature, so having it in bUnit made little sense. One such alternative, which bUnit has adopted internally, is to use Serilog. This looks as follows:Add the following packages to your test project:
Serilog
,Serilog.Extensions.Logging
, andSerilog.Sinks.XUnit
.Add the following class/extension method to your test project (which replicates the signature of the removed
AddXunitLogger
method):The
bunit.xunit
package has been removed, since it is no longer needed (there is no code left in it).v1.0.0-preview-02
The following section list all changes in 1.0.0 preview 02.
The plan is to make this the last preview release of bUnit. If no big blocking bugs show up the next two weeks, a non-preview release of bUnit will be pushed out to the world.
Added
List of new features.
Added the ability to pass a "fallback
IServiceProvider
" to theTestServiceProvider
, available through theServices
property on aTestContext
. The fallback service provider enables a few interesting scenarios, such as using an alternative IoC container, or automatically generating mocks of services components under test depend on. See the Injecting Services into Components Under Test page for more details on this feature. By @thopdev in #310.Added
Task<Expection> ITestRenderer.UnhandledException
property that returns aTask<Exception>
that completes when the renderer captures an unhandled exception from a component under test. If a component is missing exception handling of asynchronous operations, e.g. in theOnInitializedAsync
method, the exception will not break the test, because it happens on another thread. To have a test fail in this scenario, you can await theUnhandledException
property on theTestContext.Renderer
property, e.g.:Added a simple fake navigation manager, which is registered by default in bUnit's service provider. When the fake navigation manager's
NavigateTo
method is called, it does two things:Set the
Uri
property to the URI passed to theNavigateTo
method (with the URI normalized to an absolute URI).Raise the
LocationChanged
event with the URI passed to theNavigateTo
method.Lets look at an example: To verify that the
<GoesToFooOnInit>
component below calls theNavigationManager.NavigateTo
method with the expected value, do the following:<GoesToFooOnInit>
component:Test code:
Since the
foo
input argument is normalized to an absolute URI, we have to do the same normalization in our assertion.The fake navigation manager's
BaseUri
is set tohttp://localhost/
, but it is not recommended to use that URL directly in your code. Instead create an assertion by getting that value from theBaseUri
property, like shown in the example above.By @egil in #345.
Added additional bUnit JSInterop
Setup
methods, that makes it possible to get complete control of invocation matching for the created handler. By @egil.Changed
List of changes in existing functionality.
WaitForAssertion
andWaitForState
now throws unhandled exception caught by the renderer from a component under test. This can happen if a component is awaiting an asynchronous operation that throws, e.g. a API call using a misconfiguredHttpClient
. By @egil in #310.Improvements to error message from bUnit's JSInterop when it receives an invocation that it has not been set up to handle. By @egil in #346.
Removed
List of now removed features.
Fixed
List of any bug fixes.
v1.0.0-preview-01
The following section list all changes in 1.0.0 preview 01.
Added
List of new features.
Added support for casting
BUnitJSRuntime
toIJSInProcessRuntime
andIJSUnmarshalledRuntime
. By @KristofferStrube in #279Added support for triggering
@ontoggle
event handlers through a dedicatedToggle()
method. By @egil in #256.Added out of the box support for
<Virtualize>
component. When a<Virtualize>
component is used in a component under test, it's JavaScript interop-calls are faked by bUnits JSInterop, and it should result in all items being rendered immediately. By @egil in #240.Added support for components that call
ElementReference.FocusAsync
. These calls are handled by the bUnits JSInterop, that also allows you to verify thatFocusAsync
has been called for a specific element. For example, if a component has rendered an<input>
element, then the following code will verify that it has been focused usingFocusAsync
:Added
Render(RenderFragment)
andRender<TComponent>(RenderFragment)
methods toTestContext
, as well as various overloads to theMarkupMatches
methods, that also takes aRenderFragment
as the expected value.Added support for
IJSRuntime.InvokeAsync<IJSObjectReference>(...)
calls from components. There is now a new setup helper methods for configuring how invocations towards JS modules should be handled. This is done with the variousSetupModule
methods available on theBunitJSInterop
type available through theTestContext.JSInterop
property. For example, to set up a module for handling calls tofoo.js
, do the following:Added support for registering services in bUnits
Services
collection that implementsIAsyncDisposable
. Suggested by @jmaillet in #249.Changed
List of changes in existing functionality.
bUnit's mock IJSRuntime has been moved to an "always on" state by default, in strict mode, and is now available through
TestContext
'sJSInterop
property. This makes it possible for first party Blazor components like the<Virtualize>
component, which depend on JSInterop, to "just work" in tests.The
Setup<TResult>(string identifier, Func<IReadOnlyList<object?>, bool> argumentsMatcher)
andSetupVoid(string identifier, Func<IReadOnlyList<object?>, bool> argumentsMatcher)
methods in bUnits JSInterop/MockJSRuntime has a new second parameter, anInvocationMatcher
.Changed
AddTestAuthorization
such that it works in Razor-based test contexts, i.e. on theFixture
andSnapshotTest
types.Removed
List of now removed features.
ShouldAllBe
methods, has mistakingly been part of the bunit.xunit package. These have been removed.Fixed
List of any bug fixes.
When an
Add
call to the component parameter collection builder was used to select a parameter that was inherited from a base component, the builder incorrectly reported the selected property/parameter as missing on the type. Reported by @nickmuller in #250.When an element, found in the DOM tree using the
Find()
, method was removed because of an event handler trigger on it, e.g. ancut.Find("button").Click()
event trigger method, anElementNotFoundException
was thrown. Reported by @nickmuller in #251.In the built-in fake authentication system in bUnit, roles and claims were not available in components through the a cascading parameter of type
Task<AuthenticationState>
. Reported by @AFAde in #253 and fixed in #291 by @egil.v1.0.0-beta-9
This release contains a couple of fixes, and adds support for .NET Preview 8 and later. There are no breaking changes in this release.
Thanks to pharry22 for submitting fixes and improvements to the documentation.
Added
List of new features.
InvokeAsync(Func<Task>)
toRenderedComponentInvokeAsyncExtensions
. By @JeroenBos in #151.ITestRenderer Renderer { get ; }
toIRenderedFragment
to make it possible to simplify theIRenderedComponentBase<TComponent>
interface. By @JeroenBos in #151.MarkupMatches
and related comparer methods. By @egil in #195.Changed
List of changes in existing functionality.
InvokeAsync()
,Render()
andSetParametersAndRender()
methods out ofIRenderedComponentBase<TComponent>
into extension methods. By @JeroenBos in #151.Markup
,Nodes
and related methods on a rendered fragment whose underlying component has been removed from the render tree (disposed) now throws aComponentDisposedException
. By @egil in #184.Fixed
List of any bug fixes.
FindComponent()
method was removed from the render tree, accessing the reference could caused bUnit to look for updates to it in the renderer, causing a exception to be thrown. By @egil in #184.v1.0.0-beta-8
Here is beta-8, a small summer vacation release this time. A few needed additions, especially around testing components that use Blazor's authentication and authorization. In addition to this, a lot of documentation has been added to https://bunit.egilhansen.com/docs/getting-started/.
Added
List of new features.
Authorization fakes added to make it much easier to test components that use authentication and authorization. Learn more in the Faking Blazor's Authentication and Authorization page. By @DarthPedro in #151.
Added
MarkupMatches(this string actual ...)
extension methods. Make it easier to compare just the text content from a DON text node with a string, while still getting the benefit of the semantic HTML comparer.Changed
List of changes in existing functionality.
TestContextBase.Dispose
made virtual to allow inheritor's to override it. By @SimonCropp in #137.Bunit.TestDoubles.JSInterop
. All classes and methods containingJs
(meaning JavaScript) renamed toJS
for consistency with Blazor'sIJSRuntime
. By @yourilima in #150v1.0.0-beta-7
There are three big changes in bUnit in this release, as well as a whole host of small new features, improvements to the API, and bug fixes. The three big changes are:
There are also some breaking changes, which we will cover first.
NOTE: The documentation is next on the TODO list, so please bear with me while I update it to reflect all the recent changes.
Breaking changes
Due to the big restructuring of the library, there are some breaking changes, hopefully for the better.
Razor test changes
Previously, the
Test
andSetup
methods on<Fixture>
and<SnapshotTest>
did not have any arguments, and the test context they represented when running, was implicitly available in the scope. This has changed with this release, such that allTest
andSetup
methods now receive the text context as an argument, and that should be used to call e.g.GetComponentUnderTest()
on.For example, if you have a razor based test that looks like this currently: