Bunsen Burner Version 7.0.0
This is a major release of the Bunsen Burner project.
It's a culmination of my own learning and journey with open source.
There is a lot of improvements in this release, including:
- Simplified DLS syntax
- Improved support for AsyncDisposable
- No need to use async await when calling the DLS
- Massive code reduction and simplification
- Whole new documentation site
- Streamlining of DSL syntax
However, there is much more that I have removed. I will
attempt to list the major changes below, and try and detail alternatives
where possible. I know this document will not be exhaustive, so please
raise an issue if you want to talk through a particular breaking change, and
we can work through it together.
My hope is that this release will make the Bunsen Burner project more
maintainable for me and easier to use for the community.
I built the library without knowing the best way to use it. At the time I
thought that I needed to build integrations into other testing ecosystems.
I did this using extension methods, which inadvertently extended the number
of terms that users needed to know.
This was a mistake, and I have removed all of these extension methods and
projects. Bunsen Burner is now a standalone project, and I will be focusing
on making it the best test DSL builder that I can.
I don't want any of my libraries to be dependent on other libraries, they must
be self-contained and fill a niche that is not already filled. This is my
current criteria for building libraries and forms the basis of my
understanding of what sustainable open source is for me. Simple to use
small and focused libraries that are easy to maintain.
Breaking Changes
Bunsen Burner Core
The core library has been simplified.
It is now just Bunsen Burner. (Hint all other projects are now gone)
The following breaking changes have been made:
Once{T}
removed
This class was essentially a Task{T}
that was wrapped by a Lazy{T}
.
There are many ways to achieve this pattern, most test frameworks have
support for setting up and tearing down resources at most once for all tests.
ManualDisposable
removed
This is now built into the DLS
class.
For more details
see auto disposable
Cache
removed
This was just a wrapper around a ConcurrentDictionary
. Rolling your own
cache is not difficult.
ArrangeData
and GivenData
removed
To simplify the DLS, and reduce the number of terms that users need to know,
I have removed these methods.
They are replaced by the Arrange
and Given
methods that now optionally
operate on a TData
object as this
.
For more details
see arrange
string
based Arrange
and Given
methods removed
Starting the Arrange
and Given
chain with an extension method off string
was a mistake.
It was used to facilitate naming tests in theories, but caused the need to
add ArrangeData
and GivenData
methods. As I wanted a simple
clean DSL with limited terms, I had to remove these methods.
The test DSL still has a name method, but is set using with
.
For more details
see theories
AssertFailsWith
and ThenFailsWith
methods replaced by Throw
The AssertFailsWith
method duplicated all Assert
variations, but operated
on the error channel.
This was a mistake, and I have replaced it with the Throw
method that will
just
return a new DSL with the result type set to Exception
. Then all the existing
Assert
methods can be used.
For more details check out
the assert on failure docs
LINQ
methods removed
The DSL is not a query language, and I have removed all the LINQ
methods.
This was done just because I could, not for any good reason.
Expression assertions now no longer throw InvalidOperationException
on failure
I have added a custom exception type ExpressionAssertionFailureException
that
is thrown when an assertion fails. It provides more information about the
failure and a better message.
Bunsen Burner AutoFixture
This project has been removed.
I would recommend using the AutoFixture
library directly.
It can be integrated into an arrange and given step without issue.
Bunsen Burner Background
This library has been removed.
It provided a way to run tests against hosted services.
I would recommend using the Microsoft.AspNetCore.TestHost
library directly.
Bunsen Burner BenchmarkDotNet
This project has been removed.
I would recommend using the BenchmarkDotNet
library directly.
Checkout CsCheck performance testing
for a fantastic alternative.
Bunsen Burner Bogus
This project has been removed.
I would recommend using the Bogus
library directly.
It can be integrated into an arrange and given step without issue.
Bunsen Burner DependencyInjection
This project has been removed.
If you are using DI you need to ensure that you have enough integration test
coverage that it tests all the DI setups.
There is no quick fix for this, DI registration can be complex and have many
edge cases. Just make sure you have enough tests.
Bunsen Burner FunctionApp
This project has been removed.
There is a lot of complexity in integration testing Azure Functions.
I would recommend just using IHost
and IHostBuilder
directly, getting
an instance of the function and calling it directly.
Bunsen Burner Hedgehog
This project has been removed.
If you like using Hedgehog, use it directly.
IMHO CsCheck is much better.
Bunsen Burner Http
This project has been removed.
There is a lot in this project.
Test Server Builder
This was a very opinionated way to build a test server.
It worked very well for my use case, but unless you are using the same
libraries as me, it is not going to be useful.
I would recommend using the Microsoft.AspNetCore.TestHost
library directly.
Jwt
This was a very opinionated way to build a JWT token.
There are many ways to build a JWT token, and I would recommend looking around
for a library that suits your needs.
HttpClient
This provided a way to mock an HttpClient
.
It did it at the factory level, and required the use of named clients.
I think it was a solid implementation. I don't have a good alternative.
Have a look around or steal the old code from the repo.
Similar projects,
- https://github.com/richardszalay/mockhttp
- https://github.com/meziantou/Meziantou.Framework/tree/main/src/Meziantou.Framework.HttpClientMock
Bunsen Burner Logging
This project has been removed.
Please consider using Meziantou.Framework it has 2 loggers that are essentially
the same as the ones I had in this project.
- https://github.com/meziantou/Meziantou.Framework/tree/main/src/Meziantou.Extensions.Logging.InMemory
- https://github.com/meziantou/Meziantou.Framework/tree/main/src/Meziantou.Extensions.Logging.Xunit
Bunsen Burner NUnit
This project has been removed.
It did not add much value.
Bunsen Burner Verify
This project has been removed.
I would recommend using the Verify
library directly in the assert step.
Bunsen Burner XUnit
This project has been removed.
It did not add much value.
What's Changed
- chore(deps): Bump HttpBuildR.Request from 1.1.2 to 1.1.3 by @dependabot
in #255 - chore(deps): Bump Meziantou.Analyzer from 2.0.61 to 2.0.78 by @dependabot
in #267 - chore(deps): Bump HttpBuildR.Response from 1.1.2 to 1.1.3 by @dependabot
in #265 - chore(deps): Bump Microsoft.NET.Test.Sdk from 17.6.2 to 17.6.3 by @dependabot
in #264 - chore(deps): Bump Meziantou.Analyzer from 2.0.78 to 2.0.84 by @dependabot
in #278 - feat: dotnet 8 upgrade by @bmazzarol
in #306 - Update dependabot.yml by @bmazzarol
in #315 - chore(deps-dev): Bump the all group with 3 updates by @dependabot
in #316 - chore(deps-dev): Bump the all group with 2 updates by @dependabot
in #318 - chore(deps-dev): Bump the all group with 2 updates by @dependabot
in #320 - chore(deps-dev): Bump the all group with 3 updates by @dependabot
in #321 - V7 by @bmazzarol in #323
**Full Changelog
**: 6.2.4...7.0.0