Releases: bmazzarol/Bunsen-Burner
7.0.0
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
6.2.4
What's Changed
- chore(deps): Bump Meziantou.Analyzer from 2.0.54 to 2.0.61 by @dependabot in #245
- chore(deps): Bump Microsoft.NET.Test.Sdk from 17.5.0 to 17.6.2 by @dependabot in #240
- fix: increase the strength of the signing key and bump identity lib [ci] by @bmazzarol in #251
- chore(deps): Bump Roslynator.Analyzers from 4.2.0 to 4.3.0 by @dependabot in #247
Full Changelog: 6.2.3...6.2.4
v6.2.3
What's Changed
- chore(deps): Bump Roslynator.Analyzers from 4.2.0 to 4.3.0 by @dependabot in #216
- chore(deps): Bump SonarAnalyzer.CSharp from 8.56.0.67649 to 9.0.0.68202 by @dependabot in #215
- chore(deps): Bump Meziantou.Analyzer from 2.0.37 to 2.0.45 by @dependabot in #214
- chore(deps): Bump Verify.NUnit from 19.13.0 to 19.14.0 by @dependabot in #217
- chore(deps): Bump System.IdentityModel.Tokens.Jwt from 6.29.0 to 6.30.0 by @dependabot in #218
- chore(deps): Bump Verify.NUnit from 19.13.0 to 19.14.1 by @dependabot in #219
- chore(deps): Bump csharpier from 0.23.0 to 0.24.2 by @dependabot in #220
- chore(deps): Bump HttpBuildR.Response from 1.1.1 to 1.1.2 by @dependabot in #224
- chore(deps): Bump Microsoft.IdentityModel.Tokens from 6.29.0 to 6.30.0 by @dependabot in #223
- chore(deps): Bump WireMock.Net from 1.5.23 to 1.5.24 by @dependabot in #222
- chore(deps): Bump Verify.Xunit from 19.13.0 to 19.14.1 by @dependabot in #221
- chore(deps): Bump Meziantou.Analyzer from 2.0.45 to 2.0.50 by @dependabot in #228
- chore(deps): Bump WireMock.Net from 1.5.24 to 1.5.25 by @dependabot in #227
- chore(deps): Bump Meziantou.Analyzer from 2.0.50 to 2.0.52 by @dependabot in #230
- chore(deps): Bump Verify.Xunit from 19.14.1 to 20.0.0 by @dependabot in #229
- chore(deps): Bump Microsoft.NET.Test.Sdk from 17.5.0 to 17.6.0 by @dependabot in #231
- chore(deps): Bump Meziantou.Analyzer from 2.0.52 to 2.0.54 by @dependabot in #234
- chore(deps): Bump Verify.NUnit from 19.14.1 to 20.2.0 by @dependabot in #233
- chore(deps): Bump WireMock.Net from 1.5.25 to 1.5.26 by @dependabot in #232
- chore(deps): Bump Verify.NUnit from 20.2.0 to 20.3.0 by @dependabot in #235
- feat: init documentation [ci] by @bmazzarol in #239
Full Changelog: 6.2.2...6.2.3
6.2.2
What's Changed
- chore(deps): Bump Verify.NUnit from 19.10.0 to 19.11.1 by @dependabot in #174
- chore(deps): Bump NUnit.Analyzers from 3.6.0 to 3.6.1 by @dependabot in #176
- chore(deps): Bump HttpBuildR.Request from 1.1.0 to 1.1.1 by @dependabot in #175
- chore(deps): Bump Verify.Xunit from 19.10.0 to 19.11.1 by @dependabot in #177
- chore(deps): Bump HttpBuildR.Response from 1.1.0 to 1.1.1 by @dependabot in #178
- chore(deps): Bump Meziantou.Analyzer from 2.0.19 to 2.0.20 by @dependabot in #182
- chore(deps): Bump Meziantou.Analyzer from 2.0.20 to 2.0.22 by @dependabot in #183
- chore(deps): Bump WireMock.Net from 1.5.18 to 1.5.20 by @dependabot in #184
- chore(deps): Bump Verify.NUnit from 19.11.1 to 19.11.2 by @dependabot in #185
- chore(deps): Bump Verify.Xunit from 19.11.1 to 19.11.2 by @dependabot in #186
- chore(deps): Bump SonarAnalyzer.CSharp from 8.54.0.64047 to 8.55.0.65544 by @dependabot in #187
- chore(deps): Bump WireMock.Net from 1.5.20 to 1.5.21 by @dependabot in #188
- chore(deps): Bump Meziantou.Analyzer from 2.0.22 to 2.0.26 by @dependabot in #189
- chore(deps): Bump Meziantou.Analyzer from 2.0.26 to 2.0.27 by @dependabot in #190
- chore(deps): Bump Meziantou.Analyzer from 2.0.27 to 2.0.28 by @dependabot in #191
- chore(deps): Bump Verify.NUnit from 19.11.2 to 19.12.1 by @dependabot in #200
- chore(deps): Bump Verify.Xunit from 19.11.2 to 19.12.1 by @dependabot in #199
- chore(deps): Bump System.IdentityModel.Tokens.Jwt from 6.27.0 to 6.28.1 by @dependabot in #198
- chore(deps): Bump Meziantou.Analyzer from 2.0.28 to 2.0.29 by @dependabot in #195
- chore(deps): Bump Microsoft.IdentityModel.Tokens from 6.27.0 to 6.28.1 by @dependabot in #197
- chore(deps): Bump Meziantou.Analyzer from 2.0.29 to 2.0.30 by @dependabot in #202
- chore(deps): Bump WireMock.Net from 1.5.21 to 1.5.22 by @dependabot in #201
- chore(deps): Bump Meziantou.Analyzer from 2.0.30 to 2.0.32 by @dependabot in #203
- chore(deps): Bump LanguageExt.Core from 4.4.2 to 4.4.3 by @dependabot in #204
- chore(deps): Bump Verify.NUnit from 19.12.1 to 19.12.3 by @dependabot in #205
- chore(deps): Bump Meziantou.Analyzer from 2.0.32 to 2.0.34 by @dependabot in #207
- chore(deps): Bump WireMock.Net from 1.5.22 to 1.5.23 by @dependabot in #212
Full Changelog: 6.2.1...6.2.2
v6.2.1
What's Changed
- chore(deps): Bump WireMock.Net from 1.5.14 to 1.5.15 by @dependabot in #126
- chore(deps): Bump Meziantou.Analyzer from 2.0.13 to 2.0.14 by @dependabot in #128
- chore(deps): Bump SonarAnalyzer.CSharp from 8.51.0.59060 to 8.52.0.60960 by @dependabot in #131
- chore(deps): Bump JWT from 10.0.1 to 10.0.2 by @dependabot in #130
- chore(deps): Bump Verify.NUnit from 19.7.1 to 19.8.1 by @dependabot in #133
- chore(deps): Bump Verify.Xunit from 19.7.1 to 19.8.1 by @dependabot in #132
- chore(deps): Bump Verify.Xunit from 19.8.1 to 19.8.2 by @dependabot in #135
- chore(deps): Bump Verify.NUnit from 19.8.1 to 19.8.2 by @dependabot in #134
- chore(deps): Bump HttpBuildR.Request from 1.0.0 to 1.1.0 by @dependabot in #140
- chore(deps): Bump LanguageExt.Core from 4.4.0 to 4.4.2 by @dependabot in #138
- chore(deps): Bump HttpBuildR.Response from 1.0.0 to 1.1.0 by @dependabot in #139
- chore(deps): Bump Verify.Xunit from 19.8.2 to 19.9.0 by @dependabot in #142
- chore(deps): Bump Verify.NUnit from 19.8.2 to 19.9.0 by @dependabot in #141
- chore(deps): Bump WireMock.Net from 1.5.15 to 1.5.16 by @dependabot in #143
- chore(deps): Bump Verify.Xunit from 19.9.0 to 19.9.2 by @dependabot in #145
- chore(deps): Bump Verify.NUnit from 19.9.0 to 19.9.2 by @dependabot in #144
- chore(deps): Bump Microsoft.IdentityModel.Tokens from 6.26.0 to 6.26.1 by @dependabot in #147
- chore(deps): Bump System.IdentityModel.Tokens.Jwt from 6.26.0 to 6.26.1 by @dependabot in #146
- chore(deps): Bump FluentAssertions from 6.9.0 to 6.10.0 by @dependabot in #148
- chore(deps): Bump Verify.Xunit from 19.9.2 to 19.9.3 by @dependabot in #149
- chore(deps): Bump Verify.NUnit from 19.9.2 to 19.9.3 by @dependabot in #150
- chore(deps): Bump Meziantou.Analyzer from 2.0.14 to 2.0.15 by @dependabot in #155
- chore(deps): Bump System.IdentityModel.Tokens.Jwt from 6.26.1 to 6.27.0 by @dependabot in #156
- chore(deps): Bump Microsoft.IdentityModel.Tokens from 6.26.1 to 6.27.0 by @dependabot in #154
- chore(deps): Bump Verify.Xunit from 19.9.3 to 19.10.0 by @dependabot in #160
- chore(deps): Bump Verify.NUnit from 19.9.3 to 19.10.0 by @dependabot in #159
- chore(deps): Bump Meziantou.Analyzer from 2.0.15 to 2.0.16 by @dependabot in #158
- chore(deps): Bump BenchmarkDotNet from 0.13.4 to 0.13.5 by @dependabot in #157
- chore(deps): Bump Meziantou.Analyzer from 2.0.16 to 2.0.17 by @dependabot in #161
- chore(deps): Bump AutoFixture from 4.17.0 to 4.18.0 by @dependabot in #163
- chore(deps): Bump Microsoft.NET.Test.Sdk from 17.4.1 to 17.5.0 by @dependabot in #164
- chore(deps): Bump NUnit.Analyzers from 3.5.0 to 3.6.0 by @dependabot in #165
- chore(deps): Bump Meziantou.Analyzer from 2.0.17 to 2.0.18 by @dependabot in #166
- chore(deps): Bump SonarAnalyzer.CSharp from 8.52.0.60960 to 8.53.0.62665 by @dependabot in #162
- chore(deps): Bump coverlet.collector from 3.1.2 to 3.2.0 by @dependabot in #167
- chore(deps): Bump NUnit3TestAdapter from 4.3.1 to 4.4.0 by @dependabot in #168
- chore(deps): Bump WireMock.Net from 1.5.16 to 1.5.17 by @dependabot in #169
- chore(deps): Bump Meziantou.Analyzer from 2.0.18 to 2.0.19 by @dependabot in #170
- chore(deps): Bump NUnit3TestAdapter from 4.4.0 to 4.4.2 by @dependabot in #171
- chore(deps): Bump WireMock.Net from 1.5.17 to 1.5.18 by @dependabot in #173
- chore(deps): Bump SonarAnalyzer.CSharp from 8.53.0.62665 to 8.54.0.64047 by @dependabot in #172
Full Changelog: 6.2.0...6.2.1
Operators & and | added to request matchers for composition
What's Changed
- chore(deps): Bump Verify.NUnit from 19.6.0 to 19.7.1 by @dependabot in #118
- chore(deps): Bump Verify.Xunit from 19.6.0 to 19.7.1 by @dependabot in #119
- chore(deps): Bump JWT from 10.0.0 to 10.0.1 by @dependabot in #117
- chore(deps): Bump Meziantou.Analyzer from 2.0.8 to 2.0.10 by @dependabot in #122
- chore(deps): Bump Microsoft.IdentityModel.Tokens from 6.25.1 to 6.26.0 by @dependabot in #121
- chore(deps): Bump System.IdentityModel.Tokens.Jwt from 6.25.1 to 6.26.0 by @dependabot in #120
- chore(deps): Bump Meziantou.Analyzer from 2.0.10 to 2.0.13 by @dependabot in #123
- chore(deps): Bump WireMock.Net from 1.5.13 to 1.5.14 by @dependabot in #124
- feat(http): operator support for request matchers [ci] by @bmazzarol in #125
Full Changelog: 6.1.1...6.2.0
Bugfix - Always match on original string for request URI
What's Changed
- chore(deps): Bump FluentAssertions from 6.8.0 to 6.9.0 by @dependabot in #110
- chore(deps): Bump Meziantou.Analyzer from 2.0.5 to 2.0.7 by @dependabot in #112
- chore(deps): Bump BenchmarkDotNet from 0.13.3 to 0.13.4 by @dependabot in #111
- chore(deps): Bump Meziantou.Analyzer from 2.0.7 to 2.0.8 by @dependabot in #113
- fix(http): always match on original string for request URI [ci] by @bmazzarol in #114
Full Changelog: 6.1.0...6.1.1
6.1.0 - Expose the clone request function
What's Changed
- feat(http): expose clone request function by @bmazzarol in #108
Full Changelog: 6.0.0...6.1.0
Testable HttpClient!
This adds a solution for testing http client
using a http message store.
using HttpBuildR;
using static BunsenBurner.Http.HttpMessageMatchers;
using Req = System.Net.Http.HttpMethod;
using Resp = System.Net.HttpStatusCode;
var store = HttpMessageStore.New();
store.Setup(
// for a given named client
"PersonService",
// matchers can be used and composed to match incomming requests
HasMethod(HttpMethod.Put).And(HasJsonContent((Person p) => p.Age > 19))),
// response builder can be provided
req => Resp.OK.Result(request: req)
.WithJsonContent(new { LastUpdatedDate = DateTime.Now })
...
// now a store can be converted to a client, or passed to a DummyFactory
var client = store.CreateClient("PersonService");
// now call the client
var result = await client.SendAsync(Req.Put.To("some-endpoint")
.WithBearerToken(...)
.WithJsonContent(new Person(25)));
// the store records all requests and responses made against it
Assert.True(store.Any(m => m.ClientName == "PersonService"
&& m.Request.Method == HttpMethod.Put
&& m.Response.StatusCode == Resp.OK))
BREAKING CHANGES:
- Request has been replaced by the standard
HttpRequestMessage and uses HttpBuildR.Request for usability - Response has been replaced by the standard HttpResponseMessage
and uses HttpBuildR.Response for usability - This breaks how request responses are built and is also not 100% immutable
- However it allows for interop with low level request response semantics
- The Connect Http method is not supported on standard 2.0
- Converting to an Azure Request is now async, so requires awaiting
For an example of how to change your code base see the pr changes that introduced this. Essentually move over to using HttpBuildR instead of the old custom Request and Response types
What's Changed
- chore(deps): Bump JWT from 9.0.3 to 10.0.0 by @dependabot in #100
- chore(deps): Bump Meziantou.Analyzer from 2.0.3 to 2.0.4 by @dependabot in #99
- chore(deps): Bump Verify.Xunit from 19.5.0 to 19.6.0 by @dependabot in #102
- chore(deps): Bump Verify.NUnit from 19.5.0 to 19.6.0 by @dependabot in #101
- chore(deps): Bump Meziantou.Analyzer from 2.0.4 to 2.0.5 by @dependabot in #103
- feat(http,function-app): testable http client by @bmazzarol in #107
Full Changelog: 5.3.1...6.0.0
v5.3.1
What's Changed
- chore(deps): Bump Meziantou.Analyzer from 1.0.758 to 2.0.3 by @dependabot in #97
Full Changelog: 5.3.0...5.3.1