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

assert.throws should validate that the correct exception was thrown

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: Testing Infrastructure
    • Labels:

      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

              Assignee:
              backlog-server-stm Backlog - Server Tooling and Methods (STM)
              Reporter:
              kevin.pulo Kevin Pulo
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: