Posts

Showing posts with the label pester

Pester Should -BeLike

Image
Clash Royale CLAN TAG #URR8PPP Pester Should -BeLike I have this test It 'Should not find environment' { {Add-Patchgroup -ComputerName $serversHash.serverWithNotExistingEnvironment -WarningVariable warning -WarningAction SilentlyContinue} $warning | Should -BeLike ('*55555*') } $warning contains this string (exactly as you see here with the newline and whitespace on the second row) $warning Could not add <nameOfTheServer> to patchgroup Exception message: Environment F was not found But my test is passing which should not: Context Find the environment [+] Should not find environment 79ms [+] Should find environment 147ms EDIT: seems like the test is not working at all even with -Be parameter. The test is still passing. -Be $warning | Should -Be 'randomrandom' 1 Answer 1 I'm not sure why your test is passing, that is very strange. But I think ...