Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-55609

Assignment test rewrite

    XMLWordPrintable

    Details

      Description

      The assignment tests are full of needless bloat.

      It appears that all assignment tests extend base, which has a ridonculous setUp which is not used in a great number of the tests. It's also creating a course, 7 users, and 6 groups, and requiring resetAfterTest() on each test. None of the above are cheap.

      The time taken for my machine to run the full suite is ~ 15 minutes; and 2 minutes of that is just on mod_assign.

      With the amount of setUp here, I suspect that we can probably halve time used for mod_assign.
      I also suspect that many of them aren't actual unit tests, but behavioural.

      2037 sm:MDL-54872-master> ./vendor/bin/phpunit --testsuite mod_assign_testsuite
      Moodle 3.2dev (Build: 20160817), 77350889716365104f5425e79cd2ef1e4e1e7e82
      Php: 7.0.6, pgsql: 9.4beta3, OS: Darwin 15.5.0 x86_64
      PHPUnit 5.4.8 by Sebastian Bergmann and contributors.
       
      ...............................................................  63 / 145 ( 43%)
      ............................................................... 126 / 145 ( 86%)
      ...................                                             145 / 145 (100%)
       
      Time: 2.17 minutes, Memory: 112.30MB
       
      OK (145 tests, 811 assertions)
      

      That's approx 1 second per test. Many of those tests simply do not need that setup.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dobedobedoh Andrew Nicols
              Reporter:
              dobedobedoh Andrew Nicols
              Integrator:
              David Monllaó
              Tester:
              CiBoT
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Jul/18