You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To test such assertion customization we need to make sure it passes when correct data are provided, and fails when incorrect data are provided. To test the negative case we cannot just Assert-Throw because code could throw for tons of reasons. We need to match the exception explicitly, to simplify this setup, and avoid repeating the AssertionException typename over and over Assert-ThrowAssertionException should be added.
Customizing assertions and testing them is good practice for environment validation. See my reasoning here.
But the usage is not limited to that, even your unit tests can take advantage of moving the assertion language to higher level of abstraction.
The text was updated successfully, but these errors were encountered:
Assert-ThrowAssertionException
is useful to test your own assertions or assertions that customize existing assertions:To test such assertion customization we need to make sure it passes when correct data are provided, and fails when incorrect data are provided. To test the negative case we cannot just
Assert-Throw
because code could throw for tons of reasons. We need to match the exception explicitly, to simplify this setup, and avoid repeating theAssertionException
typename over and overAssert-ThrowAssertionException
should be added.Customizing assertions and testing them is good practice for environment validation. See my reasoning here.
But the usage is not limited to that, even your unit tests can take advantage of moving the assertion language to higher level of abstraction.
The text was updated successfully, but these errors were encountered: