When using the PowerShell Test Adapter in Visual Studio we can discover the tests in our project, but when we try to run them we get the following message:
A parameter cannot be found that matches parameter name 'TestName'.
We use the following tests in our MyTest.Tests.ps1
BeforeAll {
Function Get-Planet ([string]$Name = '*') {
$planets = @(
@{ Name = 'Mercury' }
@{ Name = 'Venus' }
@{ Name = 'Earth' }
@{ Name = 'Mars' }
@{ Name = 'Jupiter' }
@{ Name = 'Saturn' }
@{ Name = 'Uranus' }
@{ Name = 'Neptune' }
) | ForEach-Object { [PSCustomObject] $_ }
``
$planets | Where-Object { $_.Name -like $Name }
}
}
Describe 'Get-Planet' {
It 'Given no parameters, it lists all 8 planets' {
$allPlanets = Get-Planet
$allPlanets.Count | Should -Be 8
}
}
Version 5.3.1 of Pester is installed (Get-Module -list Pester)
Version 16.11.1 of Visual Studio 2019 is installed
Does anyone have an idea what we have to fix?