xUnit v3 support / enhancements
xUnit v3 is out, and while bUnit should work without issues with it, there are new things we may want to address:
- xUnit now has a TestContext type. See https://xunit.net/docs/getting-started/v3/whats-new#test-context
- IAssertionException and ITestTimeoutException are new interfaces that we can include in bUnit and mark our assertions exceptions with. See https://xunit.net/docs/getting-started/v3/whats-new#third-party-assertion-library-extension-points
We also might wanna add xunitv3 or similar for our templates
Plus we might wanna migrate our testbase sooner or later to v3 (probably something we only wanna do for v2)
IAssertionException and ITestTimeoutException are new interfaces that we can include in bUnit and mark our assertions exceptions with. See https://xunit.net/docs/getting-started/v3/whats-new#third-party-assertion-library-extension-points
We would need an abstraction and add this behavior as a 3rd party package, not?
Otherwise we are forcing users towards a dependency of xunit.v3?
IAssertionException and ITestTimeoutException are new interfaces that we can include in bUnit and mark our assertions exceptions with. See https://xunit.net/docs/getting-started/v3/whats-new#third-party-assertion-library-extension-points
We would need an abstraction and add this behavior as a 3rd party package, not?
Otherwise we are forcing users towards a dependency of
xunit.v3?
No we simply create the interfaces in our project, probably as internal. XUnit just matches on the name. We don't need a dependency on xUnit packages.
UPDATE:
The interfaces are not included with xunit at all. There are just logic looking for interfaces with those names.
So the assertion exceptions we throw should implement an internal interface IAssertionException {}, and our WaitFor timeout exception should implement internal interface ITestTimeoutException {}, I think.
We only really have two candidates, in my opinion:
ActualExpectedAssertException and WaitForFailedException.
The latter one is tricky - as it is used in all WaitForXXX operations. Now, We might want to dissect this into two distinct exceptions that represent the nature of asserting and timeout. Because WaitForElement isn't necessarily an assertion.
All other exceptions like ParameterException, ElementRemovedFromDomException and friends are neither a timeout nor an assertion.
We added this to the docs as well as adding the exceptions. Therefore done on v1 and more docs on v2 for xunit.v3