Releases: LeapingGorillaLTD/Testing
Leaping Gorilla Testing v6.0.1 - Composable Test Updates
Leaping Gorilla Testing v6.0.0 - Composable Tests
Composable BDD tests is a new addition to LeapingGorilla.Testing
to attempt to address some issues that can arise as test complexity increases.
To share test setup and assertion code when using LeapingGorilla.Testing it is normal to use inheritance to achieve this. This works to a point but can get complex as more shared code is added. This typically ends up with a choice between copying and pasting a subset of the [Given]
and [Then]
methods or building increasingly complex type hierarchies with virtual methods and special case overrides.
Composable Tests tackles this with a fluent interface allowing composition of your common test building blocks into a full test. An example may look like:
Example ComposeTest() implementation:
protected override ComposedTest ComposeTest() =>
TestComposer
.Given(SomeSetupIsPerformed)
.And(SomeMoreSetupIsPerformed)
.When(TheThingIsDone)
.Then(CheckTheThingWasCorrect)
.And(AnotherThingWasCorrect);
The composable test pattern can be used alongside all existing LeapingGorilla.Testing
features. Read More in the Wiki
Leaping Gorilla Testing v5.0.0 - .Net6 Support
Net 6.0 Support
With .Net 5 seeing EOL on support on May 10th 2022, we have officially transitioned into targeting .Net 6. We still dual-target NetStandard2.0
for framework support back to 4.6.1 and .Net Core 2.0.
Package Upgrades
We have bumped NSubstitute to v4.3.0. This brought a change to how the logic around constructors works which should be accounted for but please let us know if you see any issues. This could be a breaking change if you extend WhenTestingTheBehaviourOfBase
.
We have also tidied up the packaging scripts, cleaned up some vestigial code and sorted a few documentation comments.
Package Versions in This Release
Testing Packages
Testing packages provide either specific test framework support or are the preferred way of mocking/substitution used under the covers in the library.
- NUnit - 3.13.2
- NSubstitute - 4.3.0
- XUnit - 2.4.1
Support Packages
Support packages are used in the Core project to provide fast reflection (to keep overhead to a minimum) and are required to support the underpinnings of the library.
- Microsoft.CSharp - 4.7.0
- System.Reflection.Emit - 4.7.0
- System.Reflection.Emit.Lightweight - 4.7.0
Leaping Gorilla Testing v4.3.1 - XUnit Support
XUnit support
LeapingGorilla.Testing
now fully supports XUnit as the base test framework. Usage remains exactly the same as with NUnit but your Assertions now follow the XUnit patterns. Take a look at the XUnit.Tests
project for practical examples - yes, we test the library using itself. Install using nuget with:
install-package LeapingGorilla.Testing.XUnit
Package Upgrades
We have bumped our referenced packages to their latest versions:
Testing Packages
Testing packages provide either specific test framework support or are the preferred way of mocking/substitution used under the covers in the library.
- NUnit - 3.13.2
- NSubstitute - 4.2.2
- XUnit - 2.4.1
Support Packages
Support packages are used in the Core project to provide fast reflection (to keep overhead to a minimum) and are required to support the underpinnings of the library.
- Microsoft.CSharp - 4.7.0
- System.Reflection.Emit - 4.7.0
- System.Reflection.Emit.Lightweight - 4.7.0
Leaping Gorilla Testing 4.2.17
Given
methods may now have a return type of Task and may optionally be decorated with the async
keyword. This means you can more easily call async methods in your setup code. This is particularly useful when writing integration tests. Hat tip to @brianfeucht for the feature request.
Leaping Gorilla Testing 4.2.15
The When attribute is used to specify the entry point for your test and marks the method which will be executed by the LeapingGorilla.Testing library. This release adds an optional parameter to the When attribute:
DoNotRethrowExceptions
.
Any exceptions that occur during execution of your When method will be unwrapped and stored in the ThrownException
property. You can then Assert against the ThrownException
property in your tests to ensure that an Exception did (or did not) occur.
Additionally if DoNotRethrowExceptions
is set to true then the exception will not be rethrown - it will just be swallowed meaning no need for you to wrap your statements in the When method with a try/catch
Leaping Gorilla Testing v4.1.0
- Support for an
[ItemUnderTest]
to be automatically created usinginternal
constructors (PR #2) - Tidy up build scripts