-
Improvement
-
Resolution: Fixed
-
Major
-
3.0.5, 3.1, 3.4.3
-
MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_34_STABLE
-
MOODLE_34_STABLE, MOODLE_35_STABLE
-
MDL-55609-master -
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.