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

Check behat database and dataroot versions against code version also before running the tests

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      We need to ensure that if the codebase version is higher than the behat test site version (database and dataroot) an exception (informing that you need to drop and install again the site) will be thrown then trying to run the tests.

      IF you already have your behat test environment installed and enabled:

      • Pull the latest integration version or edit /version.php and change $version to an higher version
      • Run the tests (you don't need to run the Javascript ones)
      • You SHOULD see an exception stating that your behat testing site is outdated
      • cd /to/your/dirroot
      • php admin/tool/behat/cli/util.php --drop
      • php admin/tool/behat/cli/util.php --install
      • php admin/tool/behat/cli/util.php --enable
      • Run the tests again (vendor/bin/behat --config ......)
      • You SHOULD NOT see the exception any more and the tests SHOULD run as normal
      • Restore your version.php to avoid future conflicts

      ELSE you don't have your behat tests environment installed and enabled:

      • Install your behat testing environment
      • Run the tests (you don't need to run the Javascript ones)
      • Edit version.php and change $version to an higher version
      • Try to run again the tests
      • You SHOULD receive an exception stating that your behat testing site is outdated
      • cd /to/your/dirroot
      • php admin/tool/behat/cli/util.php --drop
      • php admin/tool/behat/cli/util.php --install
      • php admin/tool/behat/cli/util.php --enable
      • Run the tests again (vendor/bin/behat --config ......)
      • You SHOULD NOT see the exception any more and the tests SHOULD run as normal
      • Restore your version.php to avoid future conflicts

      (Note that some tests can fail due to unavailable elements, the error would be something like "there is no element with id|label|title 'Username'". Further work is being done in MDL-37750 to solve it.)

      Show
      We need to ensure that if the codebase version is higher than the behat test site version (database and dataroot) an exception (informing that you need to drop and install again the site) will be thrown then trying to run the tests. IF you already have your behat test environment installed and enabled: Pull the latest integration version or edit /version.php and change $version to an higher version Run the tests (you don't need to run the Javascript ones) http://docs.moodle.org/dev/Acceptance_testing#Running_tests You SHOULD see an exception stating that your behat testing site is outdated cd /to/your/dirroot php admin/tool/behat/cli/util.php --drop php admin/tool/behat/cli/util.php --install php admin/tool/behat/cli/util.php --enable Run the tests again (vendor/bin/behat --config ......) You SHOULD NOT see the exception any more and the tests SHOULD run as normal Restore your version.php to avoid future conflicts ELSE you don't have your behat tests environment installed and enabled: Install your behat testing environment If you don't have PHP 5.4 check $CFG->behat_switchcompletely in config-dist.php but remember to remove the var and disable the test environment after the tests http://docs.moodle.org/dev/Acceptance_testing#Installation Run the tests (you don't need to run the Javascript ones) http://docs.moodle.org/dev/Acceptance_testing#Running_tests Edit version.php and change $version to an higher version Try to run again the tests You SHOULD receive an exception stating that your behat testing site is outdated cd /to/your/dirroot php admin/tool/behat/cli/util.php --drop php admin/tool/behat/cli/util.php --install php admin/tool/behat/cli/util.php --enable Run the tests again (vendor/bin/behat --config ......) You SHOULD NOT see the exception any more and the tests SHOULD run as normal Restore your version.php to avoid future conflicts (Note that some tests can fail due to unavailable elements, the error would be something like "there is no element with id|label|title 'Username'". Further work is being done in MDL-37750 to solve it.)
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-37768_master

      Description

      To run functional tests the behat database and dataroot versions must match the code version, we are currently checking the versions when enabling/updating the list of steps definitions and refering the user to the drop/install scripts, which is good, but we also need to check it when running the tests, otherwise after upgrading moodle the functional tests will fail because all the site requests would be redirected to the install/upgrade page.

      This can be done using the behat before-suite hook.

        Attachments

          Activity

            People

            Assignee:
            dmonllao David Monllaó
            Reporter:
            dmonllao David Monllaó
            Peer reviewer:
            Mark Nelson Mark Nelson
            Integrator:
            Dan Poltawski Dan Poltawski
            Tester:
            Michael de Raadt Michael de Raadt
            Participants:
            Component watchers:
            Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              14/May/13