Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-28567

assert.throws should validate that the correct exception was thrown

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Backlog
    • Major - P3
    • Resolution: Unresolved
    • None
    • None
    • Testing Infrastructure
    • Server Tooling & Methods

    Description

      assert.throws() makes no effort to ensure that the exception that was thrown is the one that should have been thrown. There are lots of problems which can cause exceptions to be thrown, many of which are completely unrelated to what is being tested. If one of these problems is inadvertently introduced, assert.throws() will continue to succeed when it really ought to fail. Examples of this include SERVER-28547 and SERVER-21087.

      It would be better if users of assert.throws() were forced to (somehow) declare the exception that is expected to occur (eg. via substring matching?).

      Attachments

        Issue Links

          Activity

            People

              backlog-server-stm Backlog - Server Tooling and Methods (STM) (Inactive)
              kevin.pulo@mongodb.com Kevin Pulo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: