> 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/da/powershell-kommandoer/invoke-psutest.md).

# Invoke-PSUTest

Kør en PowerShell Universal Pester-testfil eller -mappe, og vent eventuelt på og returner dens resultater.

## Synopsis

Starter en Pester-testkørsel i PowerShell Universal.

## Syntaks

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

## Beskrivelse

Starter en Pester-testkørsel og returnerer en testkørselspost. Brug filtre for tag og testnavn til at målrette test. `-Wait` poller efter fuldførelse; `-Timeout` er som standard 300 sekunder, og `0` deaktiverer ventetimeouten. `-IncludeSuite` returnerer et objekt, der indeholder `TestRun` og `TestSuite` (med eller uden `-Wait`).

## Eksempler

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

## Parametre

| Parameter                | Beskrivelse                                                                      |
| ------------------------ | -------------------------------------------------------------------------------- |
| `-Path`                  | Påkrævet sti til testfil eller mappe (parametersættet Path).                     |
| `-TestFile`              | Påkrævet testfilobjekt; accepterer pipelineinput (parametersættet TestFile).     |
| `-Environment`           | Kørselsmiljø for testkørslen.                                                    |
| `-Tag`                   | Medtager tests med disse Pester-tags (alias `-TagFilter`).                       |
| `-ExcludeTag`            | Udelader tests med disse tags (alias `-ExcludeTagFilter`).                       |
| `-Test`                  | Pester-filtre for fuldt navn (aliaser `-FullName`, `-FullNameFilter`, `-Tests`). |
| `-Wait`                  | Venter på fuldførelse, før der returneres.                                       |
| `-Timeout`               | Ventetimeout i sekunder, standard 300; `0` deaktiverer den.                      |
| `-IncludeSuite`          | Returnerer både testkørslen og den fortolkede suite.                             |
| `-ComputerName`          | URL eller værtsnavn for PSU Management API (alias `-Uri`).                       |
| `-AppToken`              | App-token til Management API.                                                    |
| `-Credential`            | Legitimationsoplysninger til Management API.                                     |
| `-UseDefaultCredentials` | Bruger de aktuelle Windows-legitimationsoplysninger.                             |
| `-Integrated`            | Bruger den integrerede administrationsklient i processen.                        |
| `-TrustCertificate`      | Ignorerer fejl ved certifikatvalidering.                                         |
| `-Cookies`               | Genbruger sessionscookies til godkendelse.                                       |

## Output

`PowerShellUniversal.Models.Testing.TestRun`, eller et objekt, der indeholder `TestRun` og `TestSuite`, når `-IncludeSuite` er angivet.

## Tilladelser

Adgangstokenet kræver `automation.tests/execute` for at køre denne cmdlet eksternt.


---

# 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/da/powershell-kommandoer/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.
