Uploaded image for project: 'Moodle Community Sites'
  1. Moodle Community Sites
  2. MDLSITE-5960

Ban use of resetAfterTest in shared setup

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: Coding style
    • Labels:
      None

      Description

      This leads to the authorship of test files where it is not possible to write tests which do not reset after test.

      The call to resetAfterTest should be made immediately before data is inserted for the first time in either:

      • a test function
      • a helper

      It is possible to call resetAfterTest multiple times within a single test, so this is fine.

      Generally shared setUp should not create things which must be tidied. We should be careful of how we use it. See MDL-55609 for one example where we saved 10% of the total time required by refactoring tests to be better organised.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dobedobedoh Andrew Nicols
              Participants:
              Component watchers:
              Marina Glancy, Eloy Lafuente (stronk7)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: