Moodle

Migrate all "old" FakeDBUnitTestCase to UnitTestCaseUsingDatabase counterparts

Details

  • Type: Task Task
  • Status: Open Open
  • Priority: Critical Critical
  • Resolution: Unresolved
  • Affects Version/s: 2.0
  • Fix Version/s: STABLE backlog
  • Component/s: Unit tests
  • Labels:
  • Difficulty:
    Difficult
  • Affected Branches:
    MOODLE_20_STABLE

Description

Some months ago FakeDBUnitTestCase were left nominally out. With that, an important number of tests have remained "hidden" (skipped) since then.

Since yesterday (Nov 30th 2009), due to MDL-21007, they are, at least, showed as exceptions when running unit tests with message:

"Unit test XXXX of type FakeDBUnitTestCase no longer supported. Must be migrated to UnitTestCaseUsingDatabase"

So current tests in core using FakeDBUnitTestCase must be migrated to newer UnitTestCaseUsingDatabase alternative. That includes, at least:

  • grade tests
  • portfolio tests
  • completion and condition tests
  • simpletest tests

So steps are:

  • Migrate all the tests
  • Document UnitTestCaseUsingDatabase
  • Drop FakeDBUnitTestCase completely from HEAD

Issue Links

Activity

Hide
Eloy Lafuente (stronk7) added a comment -

I've started with grade ones to learn how that is supposed to work.

Show
Eloy Lafuente (stronk7) added a comment - I've started with grade ones to learn how that is supposed to work.
Hide
Sam Marshall added a comment -

I changed completionlib - as noted, it didn't even need to be using this class, however there were a couple unrelated failures in unit tests (due to a variable being missing from a fake course-module object) which I fixed.

I have not done conditionlib yet - if you want me to I probably can

Show
Sam Marshall added a comment - I changed completionlib - as noted, it didn't even need to be using this class, however there were a couple unrelated failures in unit tests (due to a variable being missing from a fake course-module object) which I fixed. I have not done conditionlib yet - if you want me to I probably can
Hide
Eloy Lafuente (stronk7) added a comment -

FYI I've just implemented one xmldb_structures cache in install_one_table_from_xmldb_file(), so it only needs to load each xmldb_structure once per request (used to be thousands). 100x speedup for those tests. Ciao

Show
Eloy Lafuente (stronk7) added a comment - FYI I've just implemented one xmldb_structures cache in install_one_table_from_xmldb_file(), so it only needs to load each xmldb_structure once per request (used to be thousands). 100x speedup for those tests. Ciao
Hide
Eloy Lafuente (stronk7) added a comment -

Yay, all grade tests running (300 tests / 2 fails / 0 exceptions). Only 40 seconds to tun all them (used to be near 40 minutes)

Show
Eloy Lafuente (stronk7) added a comment - Yay, all grade tests running (300 tests / 2 fails / 0 exceptions). Only 40 seconds to tun all them (used to be near 40 minutes)
Hide
Eloy Lafuente (stronk7) added a comment -

Hi Sam,

I've already modified conditionlib tests and I'm getting:

1/1 test cases complete: 50 passes, 4 fails and 0 exceptions.

Not sure if those 4 fails are really failed tests or it's due to something missing in the "initialisation" code. If so, fill_records() should be the place to insert the missing bits (or another private function if things are different from simply inserting some records).

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Hi Sam, I've already modified conditionlib tests and I'm getting: 1/1 test cases complete: 50 passes, 4 fails and 0 exceptions. Not sure if those 4 fails are really failed tests or it's due to something missing in the "initialisation" code. If so, fill_records() should be the place to insert the missing bits (or another private function if things are different from simply inserting some records). Ciao
Hide
Eloy Lafuente (stronk7) added a comment -

Oki, only portfolio ones (15) are pending... Penny have you already done anything? HackFest?I'd want to spend some hours trying to workout a bit the backup/restore docs for 2.0.

Show
Eloy Lafuente (stronk7) added a comment - Oki, only portfolio ones (15) are pending... Penny have you already done anything? HackFest?I'd want to spend some hours trying to workout a bit the backup/restore docs for 2.0.
Hide
Penny Leach added a comment -

Not yet I hope to be able to get through these at the hackfest, but probably won't be able to beforehand.

Show
Penny Leach added a comment - Not yet I hope to be able to get through these at the hackfest, but probably won't be able to beforehand.
Hide
Eloy Lafuente (stronk7) added a comment -

Ping! Any news on this? Should I send it back to stable backlog so anybody from HQ get it?

Show
Eloy Lafuente (stronk7) added a comment - Ping! Any news on this? Should I send it back to stable backlog so anybody from HQ get it?

People

Dates

  • Created:
    Updated: