A library of PowerShell functions that gives testers complete control over the meaning of their assertions.
Well, at least that’s the goal.
- You can run the script
.\Release\Script\AssertLibrary.ps1
- or you can import the module
Import-Module .\Release\Module\AssertLibrary
You need PowerShell version 2 or higher.
- Include 1 of the following in your scripts or module if you want to use these functions in your automated tests
-
-
"Release\Module\AssertLibrary\" module directory.
-
"Release\Script\AssertLibrary.ps1" script file
NoteThe "Release\Script\" directory has multiple script files.
The only difference between these script files is the language used to write the documentation. For example, "AssertLibrary_en-US.ps1" contains documentation written for people who speak English in the US.
You only need 1 of these files.
-
- Online, see the following link
-
https://github.com/imfrancisd/PowerShell-Assert-Library/blob/master/docs/README.txt
- In PowerShell, if you imported the module, you can get an overview of the available functions using this command
get-help about_assertlibrary
Yes.
In fact, the functions were designed so that they can be used in different PowerShell testing frameworks. For example, if you need to rename one of the functions (because the name of the function conflicts with another function in the testing framework) then renaming that function won’t break the other functions.
Yes.
You can even use these functions directly in the shell.
- Online, see the following link
-
https://github.com/imfrancisd/PowerShell-Assert-Library/blob/master/docs
- In PowerShell, you can find the names of the functions with this command
(get-module assertlibrary*).exportedfunctions.keys
- Online, see the following link
-
https://github.com/imfrancisd/PowerShell-Assert-Library/blob/master/docs
- In PowerShell, you can view the help file for each function using PowerShell’s Get-Help cmdlet.
# this will display the help file for Group-ListItem Get-Help Group-ListItem -Full
The help file contains detailed information about the function as well as examples of how to use the function.