PowerShell/test/xUnit
PowerShell Team Bot 7db6a70b56
[master] Update branch for release (#24534)
* Update package references

* Update cgmanifest

* Update IsolatedModule.Tests.ps1

---------

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2024-10-31 15:15:28 -07:00
..
Asserts Enable CA1050: Declare types in namespaces (#13872) 2020-10-26 22:34:26 +05:00
csharp Add ConvertTo-CliXml and ConvertFrom-CliXml cmdlets (#21063) 2024-07-26 22:12:44 +05:00
AssemblyInfo.cs Bump xUnit to 2.6.3 and disable the xUnit1031 warning (#20899) 2023-12-11 14:14:39 -08:00
README.md Change docs.microsoft.com to learn.microsoft.com (#19994) 2023-07-17 15:54:17 -07:00
xunit.runner.json Make xUnit tests run sequentially to avoid race conditions caused by manipulating 'powershell.config.json' in tests (#8945) 2019-02-22 11:57:10 -08:00
xUnit.tests.csproj [master] Update branch for release (#24534) 2024-10-31 15:15:28 -07:00

xUnit Tests

The folder contains xUnit tests for PowerShell Core project.

Running xUnit Tests

Go to the top level of the PowerShell repository and run full set of tests: Start-PSxUnit inside a self-hosted copy of PowerShell.

Go to the test project folder and run dotnet test -c Release.

Use filter parameter to run only needed tests:

dotnet test -c Release --filter "FullyQualifiedName~UnitTest1   # Runs tests which have UnitTest1 in FullyQualifiedName
dotnet test --filter Name~TestMethod1   # Runs tests whose name contains TestMethod1

Creating xUnit Tests

Keep the folder structure that is for Pester ../../test/powershell and C# files ../../src.

Use namespace names started with PSTests.

namespace PSTests.YourNameSpace
{
}