Repository navigation
1.0.16
#364
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
[1.0.16] - 2021-04-11
It took a while, but its finally here: a release of bUnit without the preview/beta tag. bUnit has been stable for a long time, so this long overdue, but now at least the wait is over!
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:SourceFileFinderlibrary, which is used to discover the test components.The new package
bunit.web.testcomponentsis provided as is, without expectation of further development or enhancements. If you are using the test components currently for writing tests, it will continue to work for you. If you are starting a new project, or have few of these tests, consider switching to the "inline render fragments" style.Here is a quick comparison of the styles, using a very simple component.
First, the test component style:
The a single test in "inline render fragments" style covers both cases:
To make the snapshot test scenario even more compact, consider putting all code in one line, e.g.
Render(@<HelloWorld />).MarkupMatches(@<h1>Hello world from Blazor</h1>);.For a more complete snapshot testing experience, I recommend looking at Simon Cropp's Verify library, in particular the Verify.Blazor extension to bUnit. Verify comes with all the features you expect from a snapshot testing library.
Removed
List of now removed features.
The
AddXunitLoggermethod, which provided support for capturingILoggermessages 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:Serilog,Serilog.Extensions.Logging, andSerilog.Sinks.XUnit.AddXunitLoggermethod):The
bunit.xunitpackage has been removed, since it is no longer needed (there is no code left in it).This discussion was created from the release 1.0.16.
All reactions