You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Discussion about 'Move test "No Exception!" pattern to "ShouldBeErrorId" ' #3238
Move our test helper modules in the appropriate place where are all tools test\Tools\Modules (See )
1.1 Load the modules with Build.psm1 (It seem we have an opened bug "submodules don't reloaded")
1.2 Load the modules in Start-PSPester
1.3 Use autoload by set $env:PSModulePath in Build.psm1 or in Start-PSPester
'Move test "No Exception!" pattern to 'ShouldBeErrorId'
Currently we have up to 9 modules in different subfolders test\powershell. We should place the tools in one place. Preferably near to C# tools.
Multiple test files try load the modules multiple times and do that by relative paths. It makes sense to load these modules once per session and release test files from unnecessary code. Yes, we will have to load Build.psm1 and perhaps call Start-PSPester once per session as minimum. I prefer Start-PSPester because it perform many essential and non-obvious action (compile C# tests...) and we must focus on community users who are unaware of these subtleties.
Currently we use old Pester version without advanced support to test exceptions. Latest Pester versions already has the function but we blocked because the versions isn't still ported.
We have to use our "No Exception!" pattern to test exceptions. The problem is that we have many deviations from this pattern in test files and even bugs. In Test.Helpers.psm1 we have ShouldBeErrorId function to test exceptions which can use until migrating to a new Pester version. The new template is much shorter, simpler and easier to understand and use. It also would make it easier to migrate to native Pester function in future.
I already suggested splitting the PR. I think there is general agreement on moving to No Exception! in the helper. I would suggest starting there and a sample test or two. Once you know you have the pattern correct, move on to updating broader things like Start-PSPester and the rest of the tests.
We already actively use the pattern. So I start PR #3342 for auto-loading our test modules. This will allow us to remove the explicit loading of test modules from files and avoid their double edit.
Activity
iSazonov commentedon Mar 2, 2017
Currently we have up to 9 modules in different subfolders
test\powershell. We should place the tools in one place. Preferably near to C# tools.Multiple test files try load the modules multiple times and do that by relative paths. It makes sense to load these modules once per session and release test files from unnecessary code. Yes, we will have to load Build.psm1 and perhaps call Start-PSPester once per session as minimum. I prefer Start-PSPester because it perform many essential and non-obvious action (compile C# tests...) and we must focus on community users who are unaware of these subtleties.
Currently we use old Pester version without advanced support to test exceptions. Latest Pester versions already has the function but we blocked because the versions isn't still ported.
We have to use our "No Exception!" pattern to test exceptions. The problem is that we have many deviations from this pattern in test files and even bugs. In
Test.Helpers.psm1we haveShouldBeErrorIdfunction to test exceptions which can use until migrating to a new Pester version. The new template is much shorter, simpler and easier to understand and use. It also would make it easier to migrate to native Pester function in future.iSazonov commentedon Mar 15, 2017
Travis Plunk (@TravisEz13) Jason Shirk (@lzybkr) Steve Lee (@SteveL-MSFT) James Truher (@JamesWTruher) Dongbo Wang (@daxian-dbw)
Please make a conclusion. 🙏
I see contributors become actively use
ShouldBeErrorIdin recent times.I could split the PR #3161 to finish the job easier (to move to
ShouldBeErrorIdand remove relative paths to test modules).TravisEz13 commentedon Mar 15, 2017
I already suggested splitting the PR. I think there is general agreement on moving to
No Exception!in the helper. I would suggest starting there and a sample test or two. Once you know you have the pattern correct, move on to updating broader things likeStart-PSPesterand the rest of the tests.iSazonov commentedon Mar 16, 2017
We already actively use the pattern. So I start PR #3342 for auto-loading our test modules. This will allow us to remove the explicit loading of test modules from files and avoid their double edit.
Add autoload for test modules (#3342)
Add autoload for test modules (PowerShell#3342)