Pester and required Office 365 sessions #2055
Replies: 1 comment
-
That's really the difference between unit testing and integration testing, whether they depend on external dependencies like a test tenant or not. If you want unit tests then you should refactor and/or mock external dependencies to get consistent results when developing and/or running offline. The risk with mocking is that your mocked output might get out of sync with the real API. So maybe lock module/api-version or keep some integration tests (that you run manually?) to make sure it still actually works 🙂 |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am working on a Module which requires sessions to AzureAD and MicrosoftTeams.
I am struggling to formulate tests for my scripts as they are dependent on an active session to Office 365. The ones that work without, I could describe, but still scratching the surface...
The only way I could think of meaningfully testing something without having to rely on a test tenant to run code against is to refactor everything into smaller functions and describe tests for the functions rather than the actual script itself (here I could mock as well to get reliable and consistent output).
Is there any advisory on how to deal with O365 sessions?
Thank you,
David
Beta Was this translation helpful? Give feedback.
All reactions