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

Behat could detect if its actually connecting to a moodle instance

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      You need php 5.4 to run this test

      1. Install and enable the behat test site (without using $CFG->behat_switchcompletely)
      2. Start the php built-in server in whatever directory but a moodle site one
      3. Run vendor/bin/behat with --tags @mod_survey
      4. You SHOULD see an exception stating that the tested web address is not a test site
      5. Stop the php built-in server and start it again from moodle dirroot
      6. Run vendor/bin/behat with --tags @mod_survey
      7. You SHOULD see 1 scenario passing and no errors
      Show
      You need php 5.4 to run this test Install and enable the behat test site (without using $CFG->behat_switchcompletely) Start the php built-in server in whatever directory but a moodle site one Run vendor/bin/behat with --tags @mod_survey You SHOULD see an exception stating that the tested web address is not a test site Stop the php built-in server and start it again from moodle dirroot Run vendor/bin/behat with --tags @mod_survey You SHOULD see 1 scenario passing and no errors
    • Affected Branches:
      MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-40852_master

      Description

      Ankit started the php built in webserver in the wrong directory, and he managed to get 3 test passes run the survey tests!

      You can reproduce this by:

      1. Starting the php webserver in the wrong directory (anywhere but moodle!)
      2. running behat with --tags @mod_survey

      You'll get:

      vendor/bin/behat --config /Users/danp/moodledata/integration_behatdata/behat/behat.yml --tags @mod_survey
      ...F--------------
       
      (::) failed steps (::)
       
      01. Link matching locator "'Log in'" not found.
          In step `And I log in as "teacher1"'.                          # behat_auth::i_log_in_as()
          From scenario `Switching between the three survey types'.      # /Users/danp/git/integration/mod/survey/tests/behat/survey_types.feature:7
          Of feature `A teacher can set three types of survey activity'. # /Users/danp/git/integration/mod/survey/tests/behat/survey_types.feature
       
      1 scenario (1 failed)
      18 steps (3 passed, 14 skipped, 1 failed)
      0m10.066s
      

      1. It would be good if we could detect this case, because its an easy thing to get wrong (detect if it looks like a moodle).
      2. Why do we have 3 passes! Are they doing anything useful?!

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dmonllao David Monllaó
              Reporter:
              poltawski Dan Poltawski
              Peer reviewer:
              Ankit Agarwal
              Integrator:
              Sam Hemelryk
              Tester:
              Rossiani Wijaya
              Participants:
              Component watchers:
              Andrew Nicols, 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:
                18/Nov/13