The assertions from this repository were moved to Pester and will be shipped together with Pester 6 and newer. You can still file issues here, but no new features will be added, all new development will be done in Pester repository instead.
A set of advanced assertions for Pester to simplify how you write tests.
Assertions use approved verb Assert
and one function per assertion so you can leverage all your command discovery skills.
Assertions are split to generic and specialized. Use the generic assertion to the basic stuff and the specialized assertion to get more fancy. No more guessing what -Exactly
means for the current type. More types coming soon.
Assertions provide verbose failure messages that describe what the input was, what the output was, and why the assertion failed.
Bored by standard assertion messages, or they simply don't make much sense for your usecase? Don't worry, you can write your own.
Most objects do not print nicely, so we try hard to fix it for you so you know exactly what the input and output of your tests was. Say no to "Assertion failed because '' was not equal to ''."
The whole suite was written mostly test first, it currently has 417 tests and growing. (Yes that is almost as many tests as Pester has for the whole framework!) A simplified set of independent assertions is used to test the code to make sure everything is working correctly without unwanted dependencies.
experimental!
Got two objects and you need to know how exactly they differ? With this experimential feature you can compare whole objects and get detailed report of their differences. Get in touch and help me throw a lot of testcases on this assertion to make it better!
experimental!
Assertions pass their input to their output so you can easily chain them. Awesome for quick prototyping or when you are missing a complex assertion. Not recommended for production, because of assertion rullette. Be a hero and suggest a way to chain assertions and fail all of them at the same time.
- Install
Install for the current user by running the following:
Install-Module -Scope CurrentUser -Name Assert
Or install for all users by running this from and administrator PowerShell commandline:
Install-Module -Name Assert
- Import Import the module in your current powershell session by:
Import-Module Assert
- Use it anywhere!
"hello" | Assert-NotEqual "world"
Best way to help, is to start using this module and report bugs and feature requests. I have big plans, but my tests are still the same, so every new pair of eyes is welcome. :)