Invoke-Maester
SYNOPSIS
This is the main Maester command that runs the tests and generates a report of the results.
SYNTAX
Invoke-Maester [[-Path] <String>] [-Tag <String[]>] [-ExcludeTag <String[]>] [-OutputHtmlFile <String>]
[-OutputMarkdownFile <String>] [-OutputJsonFile <String>] [-OutputFolder <String>]
[-OutputFolderFileName <String>] [-PesterConfiguration <PesterConfiguration>] [-Verbosity <String>]
[-NonInteractive] [-PassThru] [-MailRecipient <String[]>] [-MailTestResultsUri <String>]
[-MailUserId <String>] [-TeamId <String>] [-TeamChannelId <String>] [-SkipGraphConnect]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION
Using Invoke-Maester is the easiest way to run the Pester tests and generate a report of the results.
For more advanced configuration, you can directly use the Pester module and the Export-MtHtmlReport function.
By default, Invoke-Maester runs all *.Tests.ps1 files in the current directory and all subdirectories recursively.
EXAMPLES
EXAMPLE 1
Invoke-Maester
Runs all the test files under the current folder and generates a report of the results in the ./test-results folder.
EXAMPLE 2
Invoke-Maester ./maester-tests
Runs all the tests in the folder ./tests/Maester and generates a report of the results in the default ./test-results folder.
EXAMPLE 3
Invoke-Maester -Tag 'CA'
Runs the tests with the tag "CA" and generates a report of the results in the default ./test-results folder.
EXAMPLE 4
Invoke-Maester -Tag 'CA', 'App'
Runs the tests with the tags 'CA' and 'App' and generates a report of the results in the default ./test-results folder.
EXAMPLE 5
Invoke-Maester -OutputFolder './my-test-results'
Runs all the tests and generates a report of the results in the ./my-test-results folder.
EXAMPLE 6
Invoke-Maester -OutputHtmlFile './test-results/TestResults.html'
Runs all the tests and generates a report of the results in the specified file.
EXAMPLE 7
Invoke-Maester -Path ./tests/EIDSCA
Runs all the tests in the EIDSCA folder.
EXAMPLE 8
Invoke-Maester -MailRecipient john@contoso.com
Runs all the tests and sends a report of the results to mail recipient.
EXAMPLE 9
Invoke-Maester -TeamId '00000000-0000-0000-0000-000000000000' -TeamChannelId '19%3A00000000000000000000000000000000%40thread.tacv2'
Runs all the tests and posts a summary of the results to a Teams channel.
EXAMPLE 10
Invoke-Maester -Verbosity Normal
Shows results of tests as they are run including details on failed tests.
EXAMPLE 11
$configuration = New-PesterConfiguration
$configuration.Run.Path = './tests/Maester'
$configuration.Filter.Tag = 'CA'
$configuration.Filter.ExcludeTag = 'App'
Invoke-Maester -PesterConfiguration $configuration
PARAMETERS
-Path
Specifies one or more paths to files containing tests. The value is a path\file name or name pattern. Wildcards are permitted.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Tag
Only run the tests that match this tag(s).
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ExcludeTag
Exclude the tests that match this tag(s).
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-OutputHtmlFile
The path to the file to save the test results in html format. The filename should include an .html extension.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-OutputMarkdownFile
The path to the file to save the test results in markdown format. The filename should include a .md extension.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-OutputJsonFile
The path to the file to save the test results in json format. The filename should include a .json extension.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-OutputFolder
The folder to save the test results. If PassThru and no -Output* is set, defaults to ./test-results. If set, other -Output* parameters are ignored and all formats will be generated (markdown, html, json) with a timestamp and saved in the folder.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-OutputFolderFileName
The filename to use for all the files in the output folder. e.g. 'TestResults' will generate TestResults.html, TestResults.md, TestResults.json.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PesterConfiguration
[PesterConfiguration] object for Advanced Configuration Default is New-PesterConfiguration For help on each option see New-PesterConfiguration, or inspect the object it returns. See Pester Configuration for more information.
Type: PesterConfiguration
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Verbosity
Set the Pester verbosity level. Default is 'None'. None: Shows only the final summary. Normal: Focus on successful containers and failed tests/blocks. Shows basic discovery information and the summary of all tests. Detailed: Similar to Normal, but this level shows all blocks and tests, including successful. Diagnostic: Very verbose, but useful when troubleshooting tests. This level behaves like Detailed, but also enables debug-messages.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-NonInteractive
Run the tests in non-interactive mode. This will prevent the test results from being opened in the default browser.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-PassThru
Passes the output of the Maester tests to the console.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-MailRecipient
Optional. The email addresses of the recipients. e.g. john@contoso.com No email will be sent if this parameter is not provided.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-MailTestResultsUri
Uri to the detailed test results page.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-MailUserId
The user id of the sender of the mail. Defaults to the current user. This is required when using application permissions.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-TeamId
Optional. The Teams team where the test results should be posted. To get the TeamId, right-click on the channel in Teams and select 'Get link to channel'. Use the value of groupId. e.g. ?groupId=<TeamId>
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-TeamChannelId
Optional. The channel where the message should be posted. e.g. 19%3A00000000000000000000000000000000%40thread.tacv2 To get the TeamChannelId, right-click on the channel in Teams and select 'Get link to channel'. Use the value found between channel and the channel name. e.g. /channel/<TeamChannelId>/my%20channel
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SkipGraphConnect
Skip the graph connection check. This is used for running tests that does not require a graph connection.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.