PowerShell/test/xUnit
2020-04-28 10:35:40 -07:00
..
Asserts Update copyright notice to latest guidance (#12190) 2020-03-24 11:08:37 -07:00
csharp Update copyright notice to latest guidance (#12190) 2020-03-24 11:08:37 -07:00
README.md Fix broken urls (#8653) 2019-01-15 16:20:45 -08: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 Bump Xunit.SkippableFact from 1.3.12 to 1.4.8 (#12480) 2020-04-28 10:35:40 -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
{
}