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[]>] [-IncludeLongRunning]
[-IncludePreview] [-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>] [-TeamChannelWebhookUri <String>]
[-SkipGraphConnect] [-DisableTelemetry] [-SkipVersionCheck] [-ExportCsv] [-ExportExcel] [-NoLogo]
[-DriftRoot <String>] [-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 Get-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 (except for those tagged as LongRunning and Preview) 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 (except for those tagged as LongRunning and Preview) and generates a report of the results in the default ./test-results folder.
EXAMPLE 3
Invoke-Maester -Tag 'CA' -IncludeLongRunning
Runs the tests with the tag "CA" and includes long-running tests. Generates a report of the results in the default ./test-results folder.
EXAMPLE 4
Invoke-Maester -Tag 'CA', 'App' -IncludePreview
Runs the tests with the tags 'CA' and 'App' and includes preview tests. Generates a report of the results in the default ./test-results folder.
EXAMPLE 5
Invoke-Maester -OutputFolder './my-test-results'
Runs tests and generates a report of the results in the ./my-test-results folder.
EXAMPLE 6
Invoke-Maester -OutputHtmlFile './test-results/TestResults.html'
Runs the tests and generates a report of the results in the specified file.
EXAMPLE 7
Invoke-Maester -Path ./tests/EIDSCA
Runs tests in the EIDSCA folder.
EXAMPLE 8
Invoke-Maester -MailRecipient john@contoso.com
Runs the tests and sends a report of the results to an email recipient.
EXAMPLE 9
Invoke-Maester -TeamId '00000000-0000-0000-0000-000000000000' -TeamChannelId '19%3A00000000000000000000000000000000%40thread.tacv2'
Runs the tests and posts a summary of the results to a Teams channel.
EXAMPLE 10
Invoke-Maester -TeamChannelWebhookUri 'https://some-url.logic.azure.com/workflows/invoke?api-version=2016-06-01'
Runs the tests and posts a summary of the results to a Teams channel.
EXAMPLE 11
Invoke-Maester -Verbosity Normal
Shows results of tests as they are run, including details on failed tests.
EXAMPLE 12
$configuration = New-PesterConfiguration
$configuration.Run.Path = './tests/Maester'
$configuration.Filter.Tag = 'CA'
$configuration.Filter.ExcludeTag = 'App'
Invoke-Maester -PesterConfiguration $configuration
Runs Pester tests in the ./tests/Maester folder that include the 'CA' tag and exclude the 'App' tag.
EXAMPLE 13
Connect-Maester -Service All
Invoke-Maester -IncludeLongRunning -IncludePreview
Connect to all tested services and run all tests, including the long-running and preview tests.
PARAMETERS
-Path
Specifies path to files containing tests. The value is a path\file name or a 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
-IncludeLongRunning
Include tests that can take a long time to run in tenants with a large number of objects.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-IncludePreview
Include tests that are still being tested or are dependent on preview APIs.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
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 in. If 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 prefix 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
An optional [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
This will suppress the logo when Maester starts and 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 report 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
If sending the report to an email recipient, provide a 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 results 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
-TeamChannelWebhookUri
Optional: The webhook Uri where the results message should be posted. e.g. https://some-url/?value=123 To get the Webhook Uri, right-click on the channel in Teams and select 'Workflow'. Create a workflow using the 'Post to a channel when a webhook request is received' template. Use the value after 'complete.'
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
-DisableTelemetry
Disable Telemetry If set, telemetry information will not be logged.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-SkipVersionCheck
Skip the version check. If set, the version check will not be performed.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ExportCsv
Export the results to a CSV file.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ExportExcel
Export the results to an Excel file.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-NoLogo
Do not show the Maester logo.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-DriftRoot
The root directory for configuration drift tracking.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
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.