Skip to content

Discussion about 'Move test "No Exception!" pattern to "ShouldBeErrorId" ' #3238

Closed

Description

@iSazonov

The Issue is opened on Travis Plunk (@TravisEz13) request in #3161

In short:

  1. 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

  2. 'Move test "No Exception!" pattern to 'ShouldBeErrorId'

/cc Travis Plunk (@TravisEz13) Jason Shirk (@lzybkr) Steve Lee (@SteveL-MSFT) James Truher (@JamesWTruher) Dongbo Wang (@daxian-dbw)

Activity

  1. iSazonov commented on Mar 2, 2017

    @iSazonov
    CollaboratorAuthor

    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.

  2. added
    WG-Quality-Testissues in a test or in test infrastructure
    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassif
    on Mar 4, 2017
  3. iSazonov commented on Mar 15, 2017

    @iSazonov
    CollaboratorAuthor

    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 ShouldBeErrorId in recent times.

    I could split the PR #3161 to finish the job easier (to move to ShouldBeErrorId and remove relative paths to test modules).

  4. TravisEz13 commented on Mar 15, 2017

    @TravisEz13
    Member

    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.

  5. iSazonov commented on Mar 16, 2017

    @iSazonov
    CollaboratorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-FixedThe issue is fixed.WG-Quality-Testissues in a test or in test infrastructure

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions