Skip to content

Running Unit Tests

Rob Sewell edited this page Mar 31, 2018 · 4 revisions

Running Unit Tests

Thank you for adding to this awesome project, it would not be possible without you all adding your knowledge and expertise.

Once you have cloned the repo, created a new local branch, coded your new test and added it to the relevant .Tests.ps1 file in the checks folder(You can see instructions here if you are new to git), please run a unit test to ensure that your test passes the coding standards

From the root of the module folder run

## Load the module
Import-Module .\dbachecks.psd1
## Run the Unit test
Invoke-Pester .\tests -ExcludeTag Integration

This will run all of the unit tests and check that you have followed the coding standards. It will look like this

image

and when you have finished, it will (hopefully!) look like

image

If all of the tests have passed you can create a Pull Request from your branch and your new (or improved) test will be added to the module once reviewed

If you want to only see the failures and not all the successes you can minimise the output from invoke-Pester using

## Load the module
Import-Module .\dbachecks.psd1
## Run the Unit tests
Invoke-Pester .\tests -ExcludeTag Integration  -Show Fails

image

Which will run much quicker as well :-)

Thank you Very Much for your contributions

dbachecks team

Clone this wiki locally