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

Passi un oggetto `TestFile` dalle API dei test con `-TestFile` anziché con `-Path`. Entrambi i set di parametri supportano `-ComputerName`, `-AppToken`, `-UseDefaultCredentials`, `-Integrated`, `-TrustCertificate` e `-Cookies`.

## DESCRIZIONE

`Invoke-PSUTest` avvia un'esecuzione di test Pester e restituisce il record dell'esecuzione di test creato. Utilizzi i filtri per tag e nome del test per selezionare i test. `-Wait` attende il completamento; `-IncludeSuite` aggiunge la suite analizzata all'oggetto restituito.

## 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`                | File o cartella di test da eseguire.                                                       |
| `-TestFile`            | Oggetto file di test da eseguire; accetta input dalla pipeline.                            |
| `-Environment`         | Ambiente di esecuzione per l'esecuzione di test.                                           |
| `-Tag` / `-ExcludeTag` | Include o esclude i test in base al tag Pester.                                            |
| `-Test`                | Filtro sul nome completo Pester.                                                           |
| `-Wait`                | Attende il completamento prima di restituire il risultato.                                 |
| `-Timeout`             | Timeout di attesa in secondi; il valore predefinito è 300. Imposti `0` per nessun timeout. |
| `-IncludeSuite`        | Restituisce un oggetto con `TestRun` e `TestSuite` al termine dell'esecuzione.             |

## OUTPUT

`PowerShellUniversal.Models.Testing.TestRun`, oppure un `PSCustomObject` contenente l'esecuzione e la suite quando viene utilizzato `-IncludeSuite`.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
