> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/it/comandi-powershell/invoke-psutest.md).

# Invoke-PSUTest

Esegue un file o una cartella di test Pester di PowerShell Universal e, facoltativamente, attende e restituisce i relativi risultati.

## SINOSSI

Avvia un'esecuzione di test Pester in PowerShell Universal.

## SINTASSI

```powershell
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]`.

## DESCRIZIONE

Avvia un'esecuzione di test Pester e restituisce un record di esecuzione dei test. Usi i filtri di tag e di nome del test per selezionare i test. `-Wait` esegue il polling fino al completamento; `-Timeout` è di 300 secondi per impostazione predefinita e `0` disabilita il timeout di attesa. `-IncludeSuite` restituisce un oggetto che contiene `TestRun` e `TestSuite` (con o senza `-Wait`).

## ESEMPI

```powershell
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 -IncludeSuite
```

## PARAMETRI

| Parametro                | Descrizione                                                                                    |
| ------------------------ | ---------------------------------------------------------------------------------------------- |
| `-Path`                  | Percorso obbligatorio del file o della cartella di test (set di parametri Path).               |
| `-TestFile`              | Oggetto file di test obbligatorio; accetta l'input della pipeline (set di parametri TestFile). |
| `-Environment`           | Ambiente di esecuzione per l'esecuzione di test.                                               |
| `-Tag`                   | Include i test con questi tag Pester (alias `-TagFilter`).                                     |
| `-ExcludeTag`            | Esclude i test con questi tag (alias `-ExcludeTagFilter`).                                     |
| `-Test`                  | Filtri del nome completo Pester (alias `-FullName`, `-FullNameFilter`, `-Tests`).              |
| `-Wait`                  | Attende il completamento prima di restituire il risultato.                                     |
| `-Timeout`               | Timeout di attesa in secondi, 300 per impostazione predefinita; `0` lo disabilita.             |
| `-IncludeSuite`          | Restituisce sia l'esecuzione dei test sia la suite analizzata.                                 |
| `-ComputerName`          | URL o nome host dell'API di gestione PSU (alias `-Uri`).                                       |
| `-AppToken`              | Token dell'app dell'API di gestione.                                                           |
| `-Credential`            | Credenziali dell'API di gestione.                                                              |
| `-UseDefaultCredentials` | Usa le credenziali Windows correnti.                                                           |
| `-Integrated`            | Usa il client di gestione nel processo.                                                        |
| `-TrustCertificate`      | Ignora gli errori di convalida del certificato.                                                |
| `-Cookies`               | Riutilizza i cookie di autenticazione della sessione.                                          |

## OUTPUT

`PowerShellUniversal.Models.Testing.TestRun`, oppure un oggetto che contiene `TestRun` e `TestSuite` quando è specificato `-IncludeSuite`.

## AUTORIZZAZIONI

Il token di accesso richiede `automation.tests/execute` per eseguire questo cmdlet in remoto.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/powershell-universal/it/comandi-powershell/invoke-psutest.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
