Invoke-PSUTest
Run a PowerShell Universal Pester test file or folder and optionally wait for and return its results.
SYNOPSIS
Starts a Pester test run in PowerShell Universal.
SYNTAX
Invoke-PSUTest -Path <String> [-Environment <String>] [-Tag <String[]>] [-ExcludeTag <String[]>] [-Test <String[]>] [-Wait] [-Timeout <Int32>] [-IncludeSuite] [<ConnectionOptions>] [<CommonParameters>]
Invoke-PSUTest -TestFile <TestFile> [-Environment <String>] [-Tag <String[]>] [-ExcludeTag <String[]>] [-Test <String[]>] [-Wait] [-Timeout <Int32>] [-IncludeSuite] [<ConnectionOptions>] [<CommonParameters>]<ConnectionOptions>: [-ComputerName <String>] [-AppToken <String>] [-Credential <PSCredential>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies].
DESCRIPTION
Starts a Pester test run and returns a test-run record. Use tag and test-name filters to target tests. -Wait polls for completion; -Timeout defaults to 300 seconds and 0 disables the wait timeout. -IncludeSuite returns an object containing TestRun and TestSuite (with or without -Wait).
EXAMPLES
Invoke-PSUTest -Path '.\tests\api.tests.ps1'
Invoke-PSUTest -Path '.\tests\api.tests.ps1' -Tag Smoke -ExcludeTag Slow
Invoke-PSUTest -Path '.\tests\api.tests.ps1' -Test 'API returns 200'
Invoke-PSUTest -Path '.\tests\api.tests.ps1' -Wait -IncludeSuitePARAMETERS
-Path
Required test file or folder path (Path parameter set).
-TestFile
Required test-file object; accepts pipeline input (TestFile parameter set).
-Environment
Execution environment for the test run.
-Tag
Includes tests with these Pester tags (alias -TagFilter).
-ExcludeTag
Excludes tests with these tags (alias -ExcludeTagFilter).
-Test
Pester full-name filters (aliases -FullName, -FullNameFilter, -Tests).
-Wait
Waits for completion before returning.
-Timeout
Wait timeout in seconds, default 300; 0 disables it.
-IncludeSuite
Returns both test run and parsed suite.
-ComputerName
PSU Management API URL or host name (alias -Uri).
-AppToken
Management API app token.
-Credential
Management API credentials.
-UseDefaultCredentials
Uses current Windows credentials.
-Integrated
Uses the in-process management client.
-TrustCertificate
Ignores certificate validation errors.
-Cookies
Reuses session authentication cookies.
OUTPUTS
PowerShellUniversal.Models.Testing.TestRun, or an object containing TestRun and TestSuite when -IncludeSuite is specified.
PERMISSIONS
The access token requires automation.tests/execute to run this cmdlet remotely.
Was this helpful?