0
votes

My system-tests that validate some basis group setup fail when I invoke all tests (*.tests.ps1) via Invoke-Pester.

The error is The term 'Get-AzureADObjectSetting' is not recognized as the name of a cmdlet, function, script file. This cmdlet is provided via module AzureAdPreview.

When I run the same test-file with Invoke-Pester -Script ./GroupFoobar.tests.ps1 is this error not raised.

Loads Pester modules different in some situations - I am using Pester version 4.0.4?

1
It's hard to say what is occurring without seeing your code. One possible explanation could be that the module is getting unloaded by one of your other test scripts. - Mark Wragg
Hmm but when when I ensure that the "problematic" test file is first loaded by "Invoke-Pester" occurrences the error... - thuld
Perhaps it’s the reverse then, another one of your scripts is calling import-module. - Mark Wragg

1 Answers

0
votes

Ok, using the -Force switch for the AzureAdPreview solved my problem:

Import-Module Pester Import-Module AzureAdPreview -Force Import-Module Microsoft.Xrm.Data.Powershell ...